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

Index * Series returns Index #19042

Closed
jbrockmendel opened this Issue Jan 3, 2018 · 0 comments

Comments

Projects
None yet
3 participants
@jbrockmendel
Member

jbrockmendel commented Jan 3, 2018

Opening mainly so I have something to reference in the upcoming PR.

tdi = pd.TimedeltaIndex(['0days', '1day', '2days', '3days', '4days'])
ser = Series([0, 1, 2, 3, 4], dtype=np.int64)
expected = Series(['0days', '1day', '4days', '9days', '16days'],
                          dtype='timedelta64[ns]')

result = tdi * ser
tm.assert_series_equal(result, expected)   # --> fails

>>> result
TimedeltaIndex(['0 days', '1 days', '4 days', '9 days', '16 days'], dtype='timedelta64[ns]', freq=None)

Same for division:

tdi = pd.TimedeltaIndex(['0days', '1day', '2days', '3days', '4days'])
ser = Series([1.5, 3, 4.5, 6, 7.5], dtype=np.float64)
expected = Series([tdi[n] / ser[n] for n in range(len(ser))], dtype='timedelta64[ns]')

result = tdi / ser
>>> result
TimedeltaIndex(['00:00:00', '08:00:00', '10:40:00', '12:00:00', '12:48:00'], dtype='timedelta64[ns]', freq=None)

@jreback jreback added this to the 0.23.0 milestone Jan 3, 2018

@jbrockmendel jbrockmendel changed the title from TimedeltaIndex * Series returns TimedeltaIndex to Index * Series returns Index Jan 3, 2018

jreback added a commit that referenced this issue Jan 16, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment