ENH: PeriodIndex now accepts pd.NaT by sinhrks · Pull Request #13430 · pandas-dev/pandas (original) (raw)

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation5 Commits1 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

@sinhrks

Related to #12759. PeirodIndex can be created from list/array which contains pd.NaT.

currently it raises:

pd.PeriodIndex([pd.NaT])
# ValueError: freq not specified and cannot be inferred from first element

pd.PeriodIndex([pd.Period('2011-01', freq='M'), pd.NaT])
# AttributeError: 'NaTType' object has no attribute 'ordinal'

@codecov-io

Current coverage is 84.25%

Merging #13430 into master will increase coverage by <.01%

@@ master #13430 diff @@

Files 138 138
Lines 50810 50805 -5
Methods 0 0
Messages 0 0
Branches 0 0

Powered by Codecov. Last updated by 07761c5...5990de6

jreback

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these only integers at this point? e.g. we normally use a very generic check for NaT, is_null_datetimelike

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that this is possible to be called with both int64 and object types so for sure need to check all cases here

@sinhrks

@jreback

@jreback

Labels