Q:

Pandas time interpolation - NaNs

I'm having problems interpolating over time in Pandas so I've taken it back to a very basic example and I still see the same problem.
c is the dataframe, a is the index (a datetime64 array) and b is the data (a float array)
In [104]: c
Out[104]: 
                 b
a                     
2009-04-01  386.928680
2009-06-01  386.502686

In [105]: a
Out[105]: 
0   2009-04-01
1   2009-06-01
dtype: datetime64[ns]

In [106]: b
Out[106]: 
0    386.928680
1    386.502686
dtype: float64

upsampled = c.resample('M')
interpolated = upsampled.interpolate(method='linear')

In [107]: interpolated
Out[107]: 
         b
a             
2009-04-30 NaN
2009-05-31 NaN
2009-06-30 NaN

I've tried changing the interpolation method and setting the limit keyword but nothing seems to help and I just get all NaNs.

A:

You need to change your resample to 'MS' month start to get the original values.
c.resample('MS').asfreq().interpolate(method='linear')

Output:
                     b
a                     
2009-04-01  386.928680
2009-05-01  386.715683
2009-06-01  386.502686

