Find the missing data percentage and count in pandas

Milind Soorya / October 13, 2022

1 min read

I use this piece of code almost daily. So, thought it might be a good idea to share.

Use the below code to display the missing data statistics. df⁣—Is the input dataset with missing values missing_number⁣—This gives the sum of missing values in the data frame. missing_percent⁣—This gives the percentage of missing values in the data frame.

missing_number  =  df.isnull().sum()
missing_percent  =  df.isnull().sum() *  100  /  len(df)
missing_value_df  =  pd.DataFrame({'column_name': df.columns,

'missing_count': missing_number,

'percent_missing': missing_percent})
missing_value_df  =  missing_value_df.reset_index(drop=True)

You might also like:-

Learn about building products as a Data Scientist

Get a once-per-month email with my latest article and additional details about my launches, products, and experiments ✨

No spam, sales, or ads. Unsubscribe as your heart desires.