API: Change Period('NAT') to return NaT, not Period instance · Issue #12759 · pandas-dev/pandas (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Description
Code Sample, a copy-pastable example if possible
Timedelta
returns NaT
when input can be regarded as NaT
. Otherwise Period
returns its special representation (This was done in #7485 prior to Timedelta
).
pd.Timedelta('NaT')
# NaT
pd.Period('NaT', freq='M')
# Period('NaT', 'M')
Expected Output
pd.Period('NaT', freq='M')
# NaT
The fix should affects:
Period
andPeriodIndex
,Series
ops- add, sub, comp
PeriodIndex
creation from list-like which containsPeriod
andNaT
(ENH: PeriodIndex now accepts pd.NaT #13430)PeriodIndex
boxing.to_period
__contains__
any NaT-like(pd.NaT, None, float('nan'), np.nan
) (Checking for NaT in PeriodIndex doesn't work with None, pd.NaT #13582)
output of pd.show_versions()
Current master.