NumberImputation

class geoanalytics.imputation.NumberImputation.NumberImputation(dataframe)[source]

Bases: object

About this algorithm

Description:

Number Imputation replaces missing values in the dataset with a specified fixed numeric value. This is a straightforward method useful when you want to impute all missing values with a constant number, such as zero or any other specified numeric value.

Parameters:
  • Dataset (pandas DataFrame) must be provided during object initialization.

  • number (int or float) to replace missing values during the run() method (default is 0).

Attributes:
  • df (pd.DataFrame) – The input data with ‘x’, ‘y’ coordinates and features.

  • imputedDF (pd.DataFrame) – DataFrame after filling in missing values with the specified number.

  • startTime, endTime (float) – Variables to track execution time.

  • memoryUSS, memoryRSS (float) – Memory usage of the imputation process in kilobytes.

Execution methods

Calling from a Python program

import pandas as pd

from geoanalytics.imputation import NumberImputation

df = pd.read_csv("input.csv")

number_imputer = NumberImputation(df)

imputed_df = number_imputer.run(number=0)

number_imputer.getRuntime()
number_imputer.getMemoryUSS()
number_imputer.getMemoryRSS()

number_imputer.save('NumberImputation.csv')

Credits

This implementation was created by Raashika and revised by M.Charan Teja under the guidance of Professor Rage Uday Kiran.

getMemoryRSS()[source]

Prints the memory usage (RSS) of the process in kilobytes.

getMemoryUSS()[source]

Prints the memory usage (USS) of the process in kilobytes.

getRuntime()[source]

Prints the total runtime of the clustering algorithm.

run(number=0)[source]

Executes the number imputation algorithm by filling missing values with the specified number.

Parameters:

number – int or float, the numeric value to fill missing data (default 0)

Returns:

imputedDF (pd.DataFrame) – DataFrame with missing values filled

save(outputFile='NumberImputation.csv')[source]

Saves the imputed DataFrame to a CSV file.

Parameters:

outputFile – str, filename to save the imputed data (default: ‘NumberImputation.csv’)