Python Pandas Library fillna function

27 June 2023 172 Reading time: 19 second

The fillna function in the Pandas library is used to fill missing values in a DataFrame with a specific value or method. This function provides different strategies to fill missing values, such as filling with mean, median, the last value, or a specific value.


import pandas as pd

# Fill missing values with a specific value
df_filled = df.fillna(0)
print(df_filled)

Similar articles