Skip to content

ENH: add 'asm8' to NaT #11816

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

Merged
merged 1 commit into from
Dec 11, 2015
Merged

ENH: add 'asm8' to NaT #11816

merged 1 commit into from
Dec 11, 2015

Conversation

llllllllll
Copy link
Contributor

I was suprised to find that NaT.asm8 does not exist though there is a valid nat form for numpy.datetime64.

This also adds tests for the asm8 behavior for a random sample of times and NaT

@jreback
Copy link
Contributor

jreback commented Dec 10, 2015

why is this needed?

@jreback
Copy link
Contributor

jreback commented Dec 10, 2015

ahh sorry I see u moved to _Timestamp

@jreback jreback added Enhancement Datetime Datetime data dtype Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate labels Dec 11, 2015
@jreback jreback added this to the 0.18.0 milestone Dec 11, 2015
@jreback
Copy link
Contributor

jreback commented Dec 11, 2015

lgtm, ping when green.

@llllllllll
Copy link
Contributor Author

Thank you!

One question I have about the NaT class heirarchy is the purpose for the _NaT class. It is only sublclassed by NatType and seems to add a few operations.

@jreback
Copy link
Contributor

jreback commented Dec 11, 2015

the _NaT is a sub-class of _Timestamp class which is a cdef class so its purely a c-extension type. While NaTType and Timestamp are available to the python space (and the c-space).

The entire reason for this is that datetime is untimately sub-classes in c-land as its a python extension type.

@wesm original comment.

# This is PITA. Because we inherit from datetime, which has very specific
# construction requirements, we need to do object instantiation in python
# (see Timestamp class above). This will serve as a C extension type that
# shadows the python class, where we do any heavy lifting.

@llllllllll
Copy link
Contributor Author

I see, it appears cython doesn't give us a way to override the tp_new directly so we cannot create the overridden __new___ with the correct signature. Thanks for explaining this.

@llllllllll
Copy link
Contributor Author

We are green!

jreback added a commit that referenced this pull request Dec 11, 2015
@jreback jreback merged commit def7462 into pandas-dev:master Dec 11, 2015
@jreback
Copy link
Contributor

jreback commented Dec 11, 2015

thank you sir!

jreback added a commit to jreback/pandas that referenced this pull request Dec 11, 2015
jreback added a commit that referenced this pull request Dec 11, 2015
TST: avoid int conversions on windows, xref #11816
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Enhancement Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants