Skip to content

API: Change Period('NAT') to return NaT, not Period instance #12759

Closed
@sinhrks

Description

@sinhrks

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:

output of pd.show_versions()

Current master.

Metadata

Metadata

Assignees

No one assigned

    Labels

    API DesignCleanMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatePeriodPeriod data type

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions