Pandas fillna() Method – A Complete Guide

Data analysis has become an important part of our everyday life. Every day we deal with different kinds of data from different domains. One of the major challenges in data analysis is the presence of missing values or (NA) in the data. In this article, we will learn how we can handle the missing values in a dataset with the help of the fillna() method. Let’s get started!

What Is the Pandas fillna() Method and Why Is It Useful?

The Pandas Fillna()  is a method that is used to fill the missing or NA values in your dataset. You can either fill the missing values like zero or input a value. This method will usually come in handy when you are working with CSV or Excel files.

Don’t get confused with the dropna() method where we remove the missing values. In this case, we will replace the missing values with zero or with an input value from the user.

Let’s look at the syntax of the fillna() function.

DataFrame.fillna(value=None, method=None, axis=None, inplace=False, limit=None, downcast=None, **kwargs)