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

ENH: allow timedelta64 to be divided by integers #4521

Closed
jreback opened this issue Aug 9, 2013 · 0 comments · Fixed by #4534

Comments

@jreback
Copy link
Contributor

commented Aug 9, 2013

I belive numpy < 1.7 is very problematic with this, but 1.7 is ok

http://stackoverflow.com/questions/18142144/dividing-a-series-containing-datetime-by-a-series-containing-an-integer-in-panda

import pandas as pd
from pandas import Series

startdate = Series(pd.date_range('2013-01-01', '2013-01-03'))
enddate = Series(pd.date_range('2013-03-01', '2013-03-03'))

s1 = enddate - startdate
s2 = Series([2, 3, 4])

event_freq = Series(s1.values / s2)
Here are the Series:
>>> s1
0   59 days, 00:00:00
1   59 days, 00:00:00
2   59 days, 00:00:00
dtype: timedelta64[ns]

>>> s2
0    2
1    3
2    4
dtype: int64

>>> event_freq
0   29 days, 12:00:00
1   19 days, 16:00:00
2   14 days, 18:00:00
dtype: timedelta64[ns]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.