check element is present in column dataframe python code example
Example 1: check if column exists in dataframe
if 'A' in df.columns:
Example 2: pandas check if value in column is in a list
df_new[df_new['l_ext'].isin([31, 22, 30, 25, 64])]
if 'A' in df.columns:
df_new[df_new['l_ext'].isin([31, 22, 30, 25, 64])]