Skip to content

tz_localize does not handle NaT #5546

Closed
@cancan101

Description

@cancan101

DatetimeIndex correctly handles NaT:

In [2]: pd.DatetimeIndex([pd.NaT])
Out[2]: 
<class 'pandas.tseries.index.DatetimeIndex'>
[NaT]
Length: 1, Freq: None, Timezone: None

But calling tz_localize leads to garbage:

In [1]: pd.DatetimeIndex([pd.NaT]).tz_localize('US/Pacific')
Out[1]: 
<class 'pandas.tseries.index.DatetimeIndex'>
[2262-04-10 00:12:43.145224192]
Length: 1, Freq: None, Timezone: US/Pacific

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateTimezonesTimezone data dtype

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions