0

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

prre72
  • 697
  • 2
  • 12
  • 23
  • 1
    This does work for me. What version of pandas do you have? – joris Apr 02 '14 at 10:13
  • I have version 0.12.0 – prre72 Apr 02 '14 at 11:01
  • Upgraded to 0.13.1 and now working! Many thanks – prre72 Apr 02 '14 at 11:28
  • Actually, to clarify. `DataFrame.interpolate` was deprecated in 0.12, and added again with in 0.13 but with other behaviour (as previously `Series.interpolate`). In 0.12 is was more something like `.replace/.fillna`, and as you can see in the docstring, you needed to give a `to_replace` argument. – joris Apr 02 '14 at 11:33

1 Answers1

1

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.

Community
  • 1
  • 1
Shravan
  • 2,553
  • 2
  • 16
  • 19