Skip to content

Instantly share code, notes, and snippets.

@GermanCM
Created March 12, 2020 08:05
Show Gist options
  • Save GermanCM/719b776693ebb8ac1b363db5070de362 to your computer and use it in GitHub Desktop.
Save GermanCM/719b776693ebb8ac1b363db5070de362 to your computer and use it in GitHub Desktop.
#source: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.interpolate.html
def imputeMissingInterpolating(array_df):
import numpy as np
for attr in array_df.columns:
attribute_interpolated = array_df[attr].interpolate(method='linear', limit_direction='both')
assert len(attribute_interpolated[np.isnan(attribute_interpolated)]) == 0
array_df[attr] = attribute_interpolated
return array_df
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment