Skip to content
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 and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: PeriodIndex now accepts pd.NaT #13430

Closed
wants to merge 1 commit into from

Conversation

sinhrks
Copy link
Member

@sinhrks sinhrks commented Jun 12, 2016

  • tests added / passed
  • passes git diff upstream/master | flake8 --diff
  • whatsnew entry

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
Copy link

codecov-io commented Jun 12, 2016

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          
==========================================
- Hits          42809      42805     -4   
+ Misses         8001       8000     -1   
  Partials          0          0          

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

raise IncompatibleFrequency(msg)

if p is tslib.NaT:
ordinals[i] = tslib.iNaT
Copy link
Contributor

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

Copy link
Contributor

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

@jreback
Copy link
Contributor

jreback commented Jun 14, 2016

lgtm. ping on green.

@jreback jreback closed this in 112685f Jun 14, 2016
@jreback
Copy link
Contributor

jreback commented Jun 14, 2016

ty sir!

@sinhrks sinhrks deleted the period_nat branch June 14, 2016 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Period Period data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants