How to check if a column exists in Pandas

This will work:

if 'A' in df:

But for clarity, I’d probably write it as:

if 'A' in df.columns:

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)