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: Index.__new__ #38665

Merged
merged 8 commits into from
Dec 29, 2020
Merged

Conversation

jbrockmendel
Copy link
Member

Aiming towards sharing more of this with Series and pd.array

@jreback jreback added Constructors Series/DataFrame/Index/pd.array Constructors Index Related to the Index class or subclasses Refactor Internal refactoring of code labels Dec 23, 2020
@jreback jreback added this to the 1.3 milestone Dec 29, 2020

elif inferred in ["floating", "mixed-integer-float", "integer-na"]:
# TODO: Returns IntegerArray for integer-na case in the future
return subarr, np.float64
data = np.asarray(subarr).astype(np.float64)
Copy link
Contributor

Choose a reason for hiding this comment

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

copy=False

Copy link
Member Author

Choose a reason for hiding this comment

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

updated+green

if not isinstance(data, (np.ndarray, Index)):
# Coerce to ndarray if not already ndarray or Index
Copy link
Contributor

Choose a reason for hiding this comment

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

can use _ensure_array on L81

Copy link
Member Author

Choose a reason for hiding this comment

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

L81 is inside ensure_array

Copy link
Contributor

Choose a reason for hiding this comment

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

oh i c, i guess i meant can you use the super class version

Copy link
Member Author

Choose a reason for hiding this comment

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

theres really only one line that gets shared, i dont think its worth it (for now at least)

@jreback jreback merged commit beb4f1b into pandas-dev:master Dec 29, 2020
@jbrockmendel jbrockmendel deleted the ref-share-constructors branch December 29, 2020 18:25
luckyvs1 pushed a commit to luckyvs1/pandas that referenced this pull request Jan 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Constructors Series/DataFrame/Index/pd.array Constructors Index Related to the Index class or subclasses Refactor Internal refactoring of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants