Pandas/Cleaning data 7 min

Missing data and cleaning

Handle NaN, types and duplicates before you analyse.

nanfillnaduplicates

Missing values show up as NaN. isna() flags them, dropna() removes rows and fillna() replaces them.

python · editable
loading editor…

Fix types explicitly with astype or the to_ helpers, and remove exact repeats with drop_duplicates.

python · editable
loading editor…

Chain your cleaning steps and reassign the result — most pandas methods return a new frame rather than editing in place.