سؤال

I am trying to interpolate missing values on my Pandas Dataframe:

              a   b    c
2013-11-19   20   28  55 
2013-11-20   27   29  54
2013-11-21  NaN  NaN  NaN
2013-11-22  NaN  NaN  NaN
2013-11-23  NaN  NaN  NaN
2013-11-14   34   62   89

unfortunately if I try to use

df1 = df1.interpolate()

i get the following error message:

TypeError: interpolate() takes at least 2 arguments (1 given)

any ideas?

Thanks

هل كانت مفيدة؟

المحلول

Latest version of pandas resolves this issue.
If you still want to use interpolate without upgrading pandas use can do this:

for col in df1.columns:
    df1[col] = df1[col].interpolate()

Refer this for more info.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top