pandas.Series.interpolate() does nothing. Why?

I am late but, this solved my problem. You need to assign the outcome to some variable or itself.

y=y.out_brd.interpolate(method='time')

You need to convert your Series to have a dtype of float64 instead of your current object. Here's an example to illustrate the difference. Note that in general object dtype Series are of limited use, the most common case being a Series containing strings. Other than that they are very slow since they cannot take advantage of any data type information.

In [9]: s = Series(randn(6), index=pd.date_range('2013-01-01 11:25:00', freq='5T', periods=6), dtype=object)

In [10]: s.iloc[1:3] = nan

In [11]: s
Out[11]:
2013-01-01 11:25:00   -0.69522
2013-01-01 11:30:00        NaN
2013-01-01 11:35:00        NaN
2013-01-01 11:40:00   -0.70308
2013-01-01 11:45:00    -1.5653
2013-01-01 11:50:00    0.95893
Freq: 5T, dtype: object

In [12]: s.interpolate(method='time')
Out[12]:
2013-01-01 11:25:00   -0.69522
2013-01-01 11:30:00        NaN
2013-01-01 11:35:00        NaN
2013-01-01 11:40:00   -0.70308
2013-01-01 11:45:00    -1.5653
2013-01-01 11:50:00    0.95893
Freq: 5T, dtype: object

In [13]: s.astype(float).interpolate(method='time')
Out[13]:
2013-01-01 11:25:00   -0.6952
2013-01-01 11:30:00   -0.6978
2013-01-01 11:35:00   -0.7005
2013-01-01 11:40:00   -0.7031
2013-01-01 11:45:00   -1.5653
2013-01-01 11:50:00    0.9589
Freq: 5T, dtype: float64

Tags:

Python

Pandas