MeanImputation
- class geoanalytics.imputation.MeanImputation.MeanImputation(dataframe)[source]
Bases:
objectAbout this algorithm
- Description:
MeanImputation fills missing values in a dataset by replacing them with the mean of their respective columns.
- Parameters:
dataframe (pd.DataFrame) – A Pandas DataFrame containing missing values.
The first two columns must represent spatial/positional attributes, typically ‘x’ and ‘y’.
- Attributes:
df (pd.DataFrame) – Original dataframe with renamed first two columns (‘x’, ‘y’) and copied features.
imputedDF (pd.DataFrame) – Stores the resulting dataframe after mean imputation.
Execution methods
Calling from a Python program
import pandas as pd from geoanalytics.imputation import MeanImputation df = pd.read_csv('data_with_nans.csv') obj = MeanImputation(df) imputed_df = obj.impute() obj.save('MeanImputation.csv')
Credits
The complete program was written by and revised by under the supervision of Professor Rage Uday Kiran.