Skip to content

BUG: incorrect casting in ndarray + DataFrame #22537

@jbrockmendel

Description

@jbrockmendel
tdi = pd.timedelta_range('1s', periods=10)
df = pd.DataFrame({'a': tdi, 'b': tdi})
arr = np.arange(2)

>>> df + arr
[...]
AssertionError
# should be TypeError, but close enough for government work

>>> arr + df
                a                      b
0 0 days 00:00:01 0 days 00:00:01.000000
1 1 days 00:00:01 1 days 00:00:01.000000
2 2 days 00:00:01 2 days 00:00:01.000000
3 3 days 00:00:01 3 days 00:00:01.000000
4 4 days 00:00:01 4 days 00:00:01.000000
5 5 days 00:00:01 5 days 00:00:01.000000
6 6 days 00:00:01 6 days 00:00:01.000000
7 7 days 00:00:01 7 days 00:00:01.000000
8 8 days 00:00:01 8 days 00:00:01.000000
9 9 days 00:00:01 9 days 00:00:01.000000

Metadata

Metadata

Assignees

No one assigned

    Labels

    Compatpandas objects compatability with Numpy or Python functionsDatetimeDatetime data dtypeTimedeltaTimedelta data type

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions