numeric_edahelper.missing_imputer
Module Contents
Functions
|
Impute the missing values using the method selected |
- numeric_edahelper.missing_imputer.missing_imputer(data, method='mean')[source]
Impute the missing values using the method selected
- Parameters
data (pandas.DataFrame) – A Pandas Dataframe for which the missing values need to be replaced or dropped
method (str, default = "mean") – The method used for imputing numerical missing values Options: “drop”, “mean”, “median”
- Returns
An imputed dataframe
- Return type
pandas.DataFrame
Examples
>>> import pandas as pd >>> import numpy as np >>> from numeric_edahelper.missing_imputer import missing_imputer >>> df = pd.DataFrame({'a':[1,2,np.nan],'b':[np.nan,1,0]}) >>> missing_imputer(df, method="median") a b 0 1.0 0.5 1 2.0 1.0 2 1.5 0.0