Created
March 12, 2020 08:05
-
-
Save GermanCM/719b776693ebb8ac1b363db5070de362 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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