Skip to content

BUG: Series.apply(to_timedelta) returns object-type Series. #5458

Closed
@danielballan

Description

@danielballan

For later (post 0.13)...

Good:

In [1]: Series(['2013-01-05']).apply(pd.to_datetime)
Out[1]:
0   2013-01-05 00:00:00
dtype: datetime64[ns]

Bad:

In [2]: Series(['00:00:01']).apply(pd.to_timedelta)
Out[2]:
0    1000000000 nanoseconds
dtype: object

This problem turned up in #5438 , resovling #5437 . Refer to the discussion there.

See tseries/tests/test_timedeltas.py, specifically test_apply_to_timedelta. Currently, Lines 304 and 311 of the latter contain commented out assert statements that, after this is resolved should be uncommented and pass.

Also see tests/test_frame.py/test_operators_timedelta64.py.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Dtype ConversionsUnexpected or buggy dtype conversionsTimedeltaTimedelta data type

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions