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: datetime with datetime ops very slow #5801

Closed
jreback opened this issue Dec 30, 2013 · 0 comments · Fixed by #5802
Closed

BUG: datetime with datetime ops very slow #5801

jreback opened this issue Dec 30, 2013 · 0 comments · Fixed by #5802
Labels
Datetime Datetime data dtype Performance Memory or execution speed performance Timedelta Timedelta data type
Milestone

Comments

@jreback
Copy link
Contributor

jreback commented Dec 30, 2013

In [1]: df = pd.DataFrame({ 'date1' : pd.Timestamp('20130101'), 'date2' : pd.date_range('20120101',periods=1000000,freq='s') })

In [2]: %timeit df['date1']-df['date2']
1 loops, best of 3: 2.17 s per loop

pretty easy fix; don't need to infer if its a series (as we know its dtype already)

should be more like this

In [3]: %timeit Series(df['date1'].astype('int64')-df['date2'].astype('int64'),dtype='m8[ns]')
10 loops, best of 3: 43 ms per loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Performance Memory or execution speed performance Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant