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

REF: separate casting out of Index.__new__ #30586

Merged
merged 2 commits into from
Jan 1, 2020

Conversation

jbrockmendel
Copy link
Member

first of two PRs to separate array casting/inference out of Index.__new__. Once both are in place, we'll be able to do all inference/casting up-front and simplify the constructor quite a bit. We'll also be able to look into sharing code between Index/Series/array, and address a handful of outstanding issues with the Index constructor.

try:
res = data.astype("i8", copy=False)
if (res == data).all():
return res # TODO: might still need to copy
Copy link
Contributor

Choose a reason for hiding this comment

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

should be in pandas/core/dtypes/cast.py and i think duplicates some code there, but ok for now.

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, there's definitely some duplication to get rid of, but first there are some kinks to iron out, in particular #21311, #17246.

pandas/core/indexes/base.py Show resolved Hide resolved
@jreback jreback added Dtype Conversions Unexpected or buggy dtype conversions Refactor Internal refactoring of code labels Jan 1, 2020
@jreback jreback added this to the 1.0 milestone Jan 1, 2020
@jreback jreback merged commit 6349c68 into pandas-dev:master Jan 1, 2020
@jreback
Copy link
Contributor

jreback commented Jan 1, 2020

thanks

@jbrockmendel jbrockmendel deleted the ref-idx-constructor branch January 1, 2020 03:09
hweecat pushed a commit to hweecat/pandas that referenced this pull request Jan 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dtype Conversions Unexpected or buggy dtype conversions Refactor Internal refactoring of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants