logo

Dropping Missing Data

Sometimes the simplest solution is to remove incomplete data.

Drop rows with any missing value:

df.dropna()

Drop rows only if all values are missing:

df.dropna(how='all')

Drop rows missing specific columns:

df.dropna(subset=['email', 'phone'])

Drop columns instead of rows:

df.dropna(axis=1)

Be careful - dropping can lose valuable data. Consider the trade-off between data completeness and sample size.

For smart missing data handling, see my Pandas course.