liveBook · Manning

Fillna

As explained in Grokking Machine Learning

fillna is a Pandas operation that replaces missing entries with a specified value or computed replacement.

fillna is a Pandas operation that replaces missing entries with a value you provide. It helps preserve useful columns instead of deleting them. section 13.2

A practical cleaning workflow is:

  • Keep a useful column when only some values are missing. section 13.2
  • Calculate a sensible replacement, such as the median for numeric data. section 13.2

Cleaning Titanic data

The Age column has 177 missing values among 891 rows. Replacing them with its median, 28, preserves the column. The two missing Embarked values become U. section 13.2

How Grokking Machine Learning covers it

How deep it goes
Demonstrates median and category replacements with executable column assignments, but does not detail fillna options.
Examples
Uses Titanic Age values filled with median 28 and Embarked values filled with the category U.
What it assumes
Assumes familiarity with DataFrame columns and missing values while introducing median-based and categorical replacement decisions.
What you can do after
Apply it via Pandas to replace numeric or categorical missing values in a cleaned DataFrame.
How it connects
Connects missing values with Pandas columns, median, categorical data, DataFrame cleaning, and CSV export.

Also explained in

Compare how 2 books explain fillna →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Machine Learning. The section links point to the parts of the book it draws on.