Skip to content

Interpolating with method='time' incorrect for resolution higher than daily #1698

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kdebrab opened this issue Jul 28, 2012 · 1 comment
Closed
Labels
Bug Datetime Datetime data dtype
Milestone

Comments

@kdebrab
Copy link
Contributor

kdebrab commented Jul 28, 2012

The following code (pandas 0.8.0b2):

import pandas as pd
index = pd.date_range('1/1/2012', periods=4, freq='12D')
ts = pd.Series([0, 12, 24, 36], index)
new_index = index.append(index + pd.DateOffset(days=1)).order()
ts.reindex(new_index).interpolate(method='time')

correctly returns:
2012-01-01 0
2012-01-02 1
2012-01-13 12
2012-01-14 13
2012-01-25 24
2012-01-26 25
2012-02-06 36
2012-02-07 36

But when exchanging days for hours:

index = pd.date_range('1/1/2012', periods=4, freq='12H')
ts = pd.Series([0, 12, 24, 36], index)
new_index = index.append(index + pd.DateOffset(hours=1)).order()
ts.reindex(new_index).interpolate(method='time')

the result is not correct:
2011-01-01 00:00:00 0
2011-01-01 01:00:00 12
2011-01-01 12:00:00 12
2011-01-01 13:00:00 12
2011-01-02 00:00:00 24
2011-01-02 01:00:00 36
2011-01-02 12:00:00 36
2011-01-02 13:00:00 36

@wesm wesm closed this as completed in fdcc106 Aug 12, 2012
@wesm
Copy link
Member

wesm commented Aug 12, 2012

thanks for the report, fixed in git master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Datetime Datetime data dtype
Projects
None yet
Development

No branches or pull requests

2 participants