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.
Also covered in
- Software Engineering for Data ScientistsIn early access (MEAP)
What to know first
- missing valueA missing value is an expected data value or observation that is absent, unavailable, unknown, or inapplicable.
- data frameA data frame is a two-dimensional tabular data structure organized into labeled rows and columns, often with columns that can contain different types of values.
Related concepts
- nanuses · NaN is a special floating-point value representing an undefined or unrepresentable numerical result.
- missing valueaddresses · A missing value is an expected data value or observation that is absent, unavailable, unknown, or inapplicable.
- pandaspart of · pandas is an open-source Python library providing labeled data structures and tools for manipulating and analyzing tabular and other structured data.
- medianuses · The median is the middle value in an ordered set of observations, or the average of the two middle values when the set has an even number of observations.
Questions about fillna
What is fillna?
fillna is a pandas method that replaces missing values in a Series or DataFrame with specified or computed values.
Which Manning books explain fillna?
Pandas Workout: 200 exercises to make you a stronger data analyst and Grokking Machine Learning.
What should I know before learning fillna?
Manning books that teach fillna usually introduce missing value and data frame first.
What is fillna part of?
Fillna is part of pandas. pandas is an open-source Python library providing labeled data structures and tools for manipulating and analyzing tabular and other structured data.
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.

