I am working on a Data set called Scania’s Air Pressure System's Failures.
The dataframe has columns with missing values.
How do I replace the zero with the mean?
I am working on a Data set called Scania’s Air Pressure System's Failures.
The dataframe has columns with missing values.
How do I replace the zero with the mean?
Copyright © 2021 Jogjafile Inc.
Assuming that the dataframe is
df, if one wants to change all the zeros throughout every column, one can usepandas.DataFrame.replacelike thisIf one wants to do it for just one column (
column_name), one can usepandas.Series.replaceas followsIf one has
NaN, one can usepandas.DataFrame.fillnaas followsIf the
NaNare just in the columncolumn_name, one can usepandas.Series.fillnaas follows