Skip to content

ENH: Cast ndarray-like datetime64 arrays to Index properly #7468

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
Jun 16, 2014

Conversation

shoyer
Copy link
Member

@shoyer shoyer commented Jun 15, 2014

It turns out that the ndarray-like arrays of dtype datetime64 were
not being properly cast to an Index, because -- due to a bug with
np.datetime64 -- calling np.asarray(x, dtype=object) if x is an
ndarray of type datetime64 results in an integer array.

This PR adds tests and a work around to pd.Index.__new__.

Related #5460

It turns out that the ndarray-like arrays of dtype datetime64 were
not being properly cast to an Index, because -- due to a bug with
np.datetime64 -- calling np.asarray(x, dtype=object) if x is an
ndarray of type datetime64 results in an *integer* array.

This PR adds tests and a work around to pd.Index.__new__.

Related pandas-dev#5460
@jreback jreback added this to the 0.14.1 milestone Jun 16, 2014
jreback added a commit that referenced this pull request Jun 16, 2014
ENH: Cast ndarray-like datetime64 arrays to Index properly
@jreback jreback merged commit 38ca1e0 into pandas-dev:master Jun 16, 2014
@jreback
Copy link
Contributor

jreback commented Jun 16, 2014

thanks

seem inocuous enough....famous last words though :)

@shoyer shoyer deleted the ndarray-like-to-index branch June 16, 2014 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants