Skip to content

datetime operations on NaT produce dangerous results  #8689

Closed
@danfrankj

Description

@danfrankj
In [189]: ser = pd.Series([np.datetime64('nat')])

In [190]: ser
Out[190]: 
0   NaT
dtype: datetime64[ns]

In [191]: ser.dt.hour
Out[191]: 
0   -1
dtype: int64

While -1 is not a valid hour it is a very valid integer and could (has) caused hard to track bugs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDatetimeDatetime data dtypeMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolate

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions