Interpolation

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

Bases: object

About this algorithm

Description:

Interpolation is a missing data imputation technique that estimates NaN values using linear interpolation between known values. It fills values in both forward and backward directions to ensure completeness.

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

  • No other parameters are required during instantiation.

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

  • imputedDF (pd.DataFrame) – DataFrame containing ‘x’, ‘y’, and imputed values.

Execution methods

Calling from a Python program

import pandas as pd

from geoanalytics.imputation import Interpolation

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

ip = Interpolation(df)

output = ip.impute()

ip.save('Interpolation.csv')

Credits

This implementation was created by and revised by 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 algorithm.

run()[source]

Performs linear interpolation to fill missing values in the dataset.

The method: - Separates ‘x’ and ‘y’ columns from the rest of the data. - Applies linear interpolation along each column. - Uses both forward and backward filling to handle edge NaNs. - Reconstructs the complete DataFrame with imputed values.

Returns:

Imputed DataFrame with original ‘x’, ‘y’ columns and interpolated features.

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

Saves the imputed DataFrame to a CSV file.

Parameters:

outputFile – The filename for saving the DataFrame. Defaults to ‘Interpolation.csv’.