from sklearn.impute import SimpleImputer imputer = SimpleImputer(missing_values = 'NaN', strategy = 'mean',axis=1) imputer = imputer.fit(df['NO (ug/m3)']) df['NO (ug/m3)'] = imputer.transform(df['NO (ug/m3)']) code example
Example: SimpleImputer
imr = Imputer(missing_values='NaN', strategy='median', axis=0)
imr = imr.fit(data[['age']])
data['age'] = imr.transform(data[['age']]).ravel()