BuildlyBuildly
DashboardExercisesProfileHelp
Data Science/Module 2: Data Analytics/Missing Data1/3
Exercise·7 min·10 XP

Count Missing Values per Column

Context. Audit a dataset — how many NaNs in each column?

Your task. Write nan_counts(df) that returns a Series indexed by column name, with the count of NaN values in each column.

Example. A df with 2 NaN in age and 1 NaN in city → {age: 2, city: 1, name: 0}.

Notes. Include columns with zero NaN. Empty df → Series with one zero per column.

Previous
Fill Missing Values in a Column
Next
Convert Column to Float