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

Comments

Projects
None yet
5 participants
@MarcMassar
Copy link

commented Jul 7, 2014

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 Bug labels Jul 7, 2014

@jreback jreback added this to the 0.15.0 milestone Jul 7, 2014

@jreback

This comment has been minimized.

Copy link
Contributor

commented Jul 7, 2014

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

@jreback

This comment has been minimized.

Copy link
Contributor

commented Jul 6, 2018

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

@discort

This comment has been minimized.

Copy link
Contributor

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
You can’t perform that action at this time.