Down sampling in pandas and spline interpolation
Question: I am working with a hourly time series data in datetime format on x-axis and
pressure on y-axis.

I want to downsample the data to 3-minute intervals and then do a spline
interpolation on the y-axis data. I don't know how and if ipython notebook
(pandas or numpy) can handle this. I have like 5136 rows of data. Thanks in
advance.

    
    
    2015/03/01 00:00:00   100.69
    2015/03/01 01:00:00   100.48
    2015/03/01 02:00:00   100.30
    


Answer: It looks like your data are sampled every hour, so when you say "downsample to
3 minutes interval," I think you mean "interpolate [somehow] between the
hourly measurements and then evaluate the interpolation at 3-minute
intervals." Is this right?

If so, try making your datetime index (or column) into a float like so:

    
    
    import datetime
    df['time_as_float'] = df.index.apply(datetime.timestamp())
    

Then start by taking a look at
[`scipy.interpolate.splrep`](http://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.splrep.html)
and its cousin
[`.splev`](http://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.splev.html)
to generate, then evaluate, the splines.

[See also here. (Related SO
question).](http://stackoverflow.com/questions/13930367/interpolating-time-
series-in-pandas-using-cubic-spline?rq=1)

