Closed
Description
Is there any interest in giving interpolate and resample (to higher frequency) some additional methods?
For example:
from scipy import interpolate
df = pd.DataFrame({'A': np.arange(10), 'B': np.exp(np.arange(10) + np.random.randn())})
xnew = np.arange(10) + .5
In [46]: df.interpolate(xnew, method='spline')
Could return something like
In [47]: pd.DataFrame(interpolate.spline(df.A, df.B, xnew, order=4), index=xnew)
Out[47]:
0
0.5 1.044413
1.5 0.798392
2.5 3.341909
3.5 8.000314
4.5 22.822819
5.5 60.957659
6.5 166.844351
7.5 451.760621
8.5 1235.969910
9.5 0.000000 # falls outside the original range so interpolate.spline sets it to 0.
I have never used the DataFrame's interpolate, but a quick glance says that something like the above wouldn't be backwards compatible with the current calling convention. Maybe a different name? This may be confusing two issues: interpolating over missing values and interpolating / predicting non-existent values. Or are they similar enought that they can be treated the same. I would think so.
These are just some quick thoughts before I forget. I haven't spent much time thinking a design through yet. I'd be happy to work on this in a month or so.
Also does this fall in the realm of statsmodels?