I am wondering how to properly check if multiple columns exist in a df
, say if I want to test if both columns A
and B
exist in df
:
if `A` in df and `B` in df:
# some code
is there a better way to do this checking? tested with ['A', 'B'] in df
, but failed.
UPDATE
pd.Series(['A', 'B']).isin(df.columns).all()
will do the work.