I build a pandas dataframe from json data :
{
'bundle': 'R_FLUSH_DEADLETTERS',
'envs': ['AG','DEV','QUAL','QUAL2','PREPROD','PREPROD2','PROD'],
'envsinfra2021': ['PREPROD2'],
},
{
'bundle': 'R201_QA069_ETIQETTENS_FROMSAP',
'envs': ['DEV','QUAL','QUAL2','PREPROD'],
'envsinfra2021': ['AG','PREPROD2','PROD'],
},
I can retrieve the rows that contain 'PROD' in the 'envsinfra2021' list-column with
df[['PROD' in x for x in df["envsinfra2021"]]]
I can retrieve the rows that contain 'PROD' in the 'envs' list-column with
df[['PROD' in x for x in df["envs"]]]
But how can I get the rows where 'PROD' is either in 'envs' or 'envsinfra2021' ? I tried this
df[ ['PROD' in x for x in df["envs"]] or ['PROD' in x for x in df["envsinfra2021"]] ]
but it returns an empty DF