Skip to content

Index * Series returns Index #19080

Closed
@jbrockmendel

Description

@jbrockmendel

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions