Skip to content

ENH: allow start=range_object in RangeIndex constructor #40241

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 5 commits into from
Mar 9, 2021

Conversation

jbrockmendel
Copy link
Member

simplifies Index.__new__ a bit

@jreback jreback added Constructors Series/DataFrame/Index/pd.array Constructors Index Related to the Index class or subclasses labels Mar 5, 2021
@jreback
Copy link
Contributor

jreback commented Mar 5, 2021

hah I originally implemented this but then we settled on .from_range. I would be +1 in using this. cc @jorisvandenbossche

@topper-123
Copy link
Contributor

I'm +1 on this change. If we call something RangeIndex, it's reasonable that it takes a range in its constructor IMO.

@jorisvandenbossche
Copy link
Member

(no strong opinion here)

@jreback jreback added this to the 1.3 milestone Mar 9, 2021
@jreback
Copy link
Contributor

jreback commented Mar 9, 2021

lgtm. I think ok to also deprecated .from_range

@topper-123
Copy link
Contributor

In the RangeIndex class doc stringm in the Parameters section, I think the line start : int (default: 0), or other RangeIndex instance should be changed to start : int (default: 0), range or other RangeIndex instance

@jbrockmendel
Copy link
Member Author

In the RangeIndex class doc stringm in the Parameters section, I think the line start : int (default: 0), or other RangeIndex instance should be changed to start : int (default: 0), range or other RangeIndex instance

good idea. will add this to my upcoming core.indexes TYP branch if thats OK

@jreback jreback merged commit 921477e into pandas-dev:master Mar 9, 2021
@jreback
Copy link
Contributor

jreback commented Mar 9, 2021

thanks @jbrockmendel

followups when you can

@jbrockmendel jbrockmendel deleted the api-ri branch March 9, 2021 17:25
@jbrockmendel jbrockmendel mentioned this pull request Mar 9, 2021
jbrockmendel added a commit to jbrockmendel/pandas that referenced this pull request Mar 11, 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API: should the RangeIndex constructor accept start=range_index?
4 participants