Pandas DataFrame fillna() method is used to fill NA/NaN values using the specified values. When we encounter any  Null values, it is changed into NA/NaN values in DataFrame. It comes into play when we work on CSV files and in Data Science and Machine Learning, we always work with CSV or Excel files.

To replace all the NaN values with zeros in a column of a Pandas DataFrame, you can use the DataFrame fillna() method.

Using the DataFrame fillna() method, we can remove the NA/NaN values by asking the user to put some value of their own by which they want to replace the NA/NaN values of the DataFrame.

It is somewhat similar to the  dropna() method there we removed the data, but here, in this case, we ask the user to input data to replace NA/NaN values.

Syntax

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

#pandas #python

Pandas DataFrame fillna() Method in Python
29.35 GEEK