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