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

loffset has no effect when passing in a numyp.timedelta64 #7687

Closed
MarcMassar opened this issue Jul 7, 2014 · 3 comments · Fixed by #22482 or #33498
Closed

loffset has no effect when passing in a numyp.timedelta64 #7687

MarcMassar opened this issue Jul 7, 2014 · 3 comments · Fixed by #22482 or #33498
Labels
Bug Error Reporting Incorrect or improved errors from pandas good first issue Needs Tests Unit test(s) needed to prevent regressions Resample resample method
Milestone

Comments

@MarcMassar
Copy link

From mailing-list: [https://groups.google.com/forum/#!topic/pydata/CDnF9cNR2ho]
When doing a re-sample, loffset has no effect if a numpy.timedelta64 is passed in:

In [1]: rng = pd.date_range('1/1/2012', periods=4, freq='S')

In [2]: ts = pd.Series(np.random.randint(0, 500, len(rng)), index=rng)

In [3]: ts.resample('2S')
Out[3]:
2012-01-01 00:00:00    396.0
2012-01-01 00:00:02    214.5
Freq: 2S, dtype: float64

In [4]: import datetime

In [5]: ts.resample('2S',loffset=datetime.timedelta(seconds=10))
Out[5]:
2012-01-01 00:00:10    396.0
2012-01-01 00:00:12    214.5
dtype: float64

In [6]: ts.resample('2S',loffset=np.timedelta64(10,'s'))
Out[6]:
2012-01-01 00:00:00    396.0
2012-01-01 00:00:02    214.5
Freq: 2S, dtype: float64
@jreback jreback added this to the 0.15.0 milestone Jul 7, 2014
@jreback
Copy link
Contributor

jreback commented Jul 7, 2014

would welcome a pull-request for this
also should raise on an invalid loffset

@jreback
Copy link
Contributor

jreback commented Jul 6, 2018

this is already fixed in master, nice to enhance the tests.

@jreback jreback modified the milestones: Contributions Welcome, 0.24.0 Jul 6, 2018
@jreback jreback added the Needs Tests Unit test(s) needed to prevent regressions label Jul 6, 2018
@discort
Copy link
Contributor

discort commented Aug 23, 2018

@jreback

this is already fixed in master, nice to enhance the tests.

It's not fixed in master. See PR ^ for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Error Reporting Incorrect or improved errors from pandas good first issue Needs Tests Unit test(s) needed to prevent regressions Resample resample method
Projects
None yet
5 participants