Command
df.fillnaExplanation
df.fillna() replaces NaN values with specified values or methods.
Examples
Replace NaN with 0
df.fillna(0)Forward fill missing values
df.fillna(method="ffill")Backward fill missing values
df.fillna(method="bfill")df.fillnadf.fillna() replaces NaN values with specified values or methods.
Replace NaN with 0
df.fillna(0)Forward fill missing values
df.fillna(method="ffill")Backward fill missing values
df.fillna(method="bfill")