Fillna
fillna is a pandas method that replaces missing values in a Series or DataFrame with specified or computed values.
Pandas Workout: 200 exercises to make you a stronger data analyst
A pandas method that replaces missing values with a specified value or computed replacement.
- How it is used
- Replaces missing Series or DataFrame values with literal or computed alternatives during data cleaning and transformation.
- How deep it goes
- Explains literal, mean, and mode replacements, returned objects, reassignment, and the tradeoff between filling and dropping values.
- Examples
- Demonstrates filling missing tens digits with zero and imputing Titanic ages with a mean and destinations with a mode.
- What you can do after
- Apply it via pandas to replace missing values with literals or statistics and preserve the result through reassignment.
Read how Pandas Workout: 200 exercises to make you a stronger data analyst explains fillna →
Grokking Machine Learning
fillna is a Pandas operation that replaces missing entries with a specified value or computed replacement.
- How it is used
- Preserves useful dataset columns by replacing missing entries during data cleaning.
- 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 you can do after
- Apply it via Pandas to replace numeric or categorical missing values in a cleaned DataFrame.
Related concepts
- nanuses · A special floating-point value representing an undefined, invalid, or unrepresentable numerical result.
- pandasuses · pandas is an open-source Python library that provides labeled data structures and tools for manipulating and analyzing tabular and other structured data.
- missing valueaddresses · A missing value is a marker or condition indicating that an expected data value or reference is absent, unavailable, unknown, or inapplicable.
- medianuses · The median is the middle value of an ordered set of observations, or the mean of the two middle values when the set has an even number of observations.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

