P03PandasBeginnerInterpret10 min

Find Missing Values by Column

Profile null values before deciding whether rows should be imputed, retained, or removed.

#pandas#nulls#data quality

Scenario

A customer table will feed a retention analysis. Before cleaning it, the team needs a concise view of missingness by column.

Problem statement

Calculate the number and percentage of missing values in each DataFrame column, ordered from most missing to least.

Your Task

  1. Use Pandas missing-value detection rather than comparing every value manually.
  2. Report both counts and rates.
  3. Explain why a high missing rate does not automatically mean a column should be dropped.

Example data

import pandas as pd

customers = pd.DataFrame({
    'customer_id': [1, 2, 3, 4],
    'age': [31, None, 44, None],
    'city': ['Pune', 'Delhi', None, 'Pune'],
    'email': ['a@example.com', 'b@example.com', 'c@example.com', 'd@example.com'],
})

Related Concepts

Pandas isnaImputationMissing-not-at-random

Ready to count this problem?

Mark it complete when you have reasoned through the solution in your own words.