Skip to content
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

BUG: resample().asfreq() looses end period with TimedeltaIndex #12926

Closed
jorisvandenbossche opened this issue Apr 19, 2016 · 2 comments
Closed
Labels
Bug Resample resample method Timedelta Timedelta data type
Milestone

Comments

@jorisvandenbossche
Copy link
Member

In [16]: df=pd.DataFrame(data=[1,3], index=[dt.timedelta(), dt.timedelta(minutes=3)])
In [17]: df
Out[17]:
          0
00:00:00  1
00:03:00  3

In [18]: df.resample('1T').mean()
Out[18]:
            0
00:00:00  1.0
00:01:00  NaN
00:02:00  NaN
00:03:00  3.0

In [19]: df.resample('1T').asfreq()
Out[19]:
            0
00:00:00  1.0
00:01:00  NaN
00:02:00  NaN

The two examples should give the same result.
Tried it with a DatetimeIndex, and there I don't see this problem.

cc @jreback

@jorisvandenbossche jorisvandenbossche added Bug Timedelta Timedelta data type Resample resample method labels Apr 19, 2016
@jorisvandenbossche jorisvandenbossche added this to the 0.18.1 milestone Apr 19, 2016
@jorisvandenbossche
Copy link
Member Author

Simple test with DatetimeIndex does work:

In [28]: df.index = df.index + pd.Timestamp('2016-01-01')

In [29]: df
Out[29]:
                     0
2016-01-01 00:00:00  1
2016-01-01 00:03:00  3

In [30]: df.resample('1T').asfreq()
Out[30]:
                       0
2016-01-01 00:00:00  1.0
2016-01-01 00:01:00  NaN
2016-01-01 00:02:00  NaN
2016-01-01 00:03:00  3.0

@jreback
Copy link
Contributor

jreback commented Apr 19, 2016

hmm, ok, logic *should8 be the same, but prob not well tested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Resample resample method Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants