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

Index * Series returns Index #19080

Closed
jbrockmendel opened this issue Jan 4, 2018 · 0 comments · Fixed by #19253
Closed

Index * Series returns Index #19080

jbrockmendel opened this issue Jan 4, 2018 · 0 comments · Fixed by #19253
Labels
Dtype Conversions Unexpected or buggy dtype conversions good first issue Numeric Operations Arithmetic, Comparison, and Logical operations
Milestone

Comments

@jbrockmendel
Copy link
Member

jbrockmendel commented Jan 4, 2018

Holdover from #19042 (see discussion in #19044), the example below applies to regular Index objects too. Easy fix (tag as good-first-PR?), just need to add a check here that returns NotImplemented if isinstance(other, ABCSeries). Updating the appropriate tests is the labor-intensive part.

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)
@jreback jreback added Dtype Conversions Unexpected or buggy dtype conversions Effort Low good first issue Numeric Operations Arithmetic, Comparison, and Logical operations labels Jan 5, 2018
@jreback jreback added this to the Next Major Release milestone Jan 5, 2018
@jreback jreback modified the milestones: Next Major Release, 0.23.0 Jan 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dtype Conversions Unexpected or buggy dtype conversions good first issue Numeric Operations Arithmetic, Comparison, and Logical operations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants