Skip to content

Series.__sub__(NaT) vs DatetimeIndex.__sub__(NaT) #18808

@jbrockmendel

Description

@jbrockmendel

One treats NaT result as datetime, other treats it as timedelta.

>>> dti = pd.DatetimeIndex([pd.NaT, pd.Timestamp('19900315')]) >>> ser = pd.Series(dti) >>> dti - pd.NaT TimedeltaIndex([NaT, NaT], dtype='timedelta64[ns]', freq=None) >>> ser - pd.NaT 0 NaT 1 NaT dtype: datetime64[ns] 

Metadata

Metadata

Assignees

No one assigned

    Labels

    DatetimeDatetime data dtypeMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateTimedeltaTimedelta data type

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions