Arthur Camberlein >> SEO & Data articles >> Find and remove empty column in Python with pandas

Find and remove empty column in Python with pandas

Written by Arthur Camberlein | Published on & updated on

Look for, find and delete/remove any empty column in a dataframe thanks to Python.


# Find the columns where each value is null
empty_cols = [col for col in df.columns if df[col].isnull().all()]

# Drop these columns from the dataframe
df.drop(empty_cols, 
  axis=1,
  inplace=True)

Find the columns where each value is null


empty_cols = [col for col in df.columns if df[col].isnull().all()]

Drop these columns from the dataframe


df.drop(empty_cols, axis=1, inplace=True)
Back to blog

Learn more with the article FAQ

Find and remove empty column in Python with pandas - FAQs

Blog post topic:  No topic assigned

Written by

With more than 10 years of experience in Marketing, Web Marketing and SEO, Arthur is specialized in Tech SEO and Data Analysis. He is currently working at Shopify, but all the views on this blog & website are his own.

Related Articles