Skip to content

Make public start, stop and step attributes for RangeIndex #25710

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

Closed
TomAugspurger opened this issue Mar 13, 2019 · 3 comments · Fixed by #25720
Closed

Make public start, stop and step attributes for RangeIndex #25710

TomAugspurger opened this issue Mar 13, 2019 · 3 comments · Fixed by #25720
Labels
API Design Index Related to the Index class or subclasses
Milestone

Comments

@TomAugspurger
Copy link
Contributor

This may be useful to downstream projects (e.g. apache/arrow#3868).

Initially, I think the idea was for RangeIndex to be a drop-in optimized replacement for the equivalent Int64Index. Other libraries might want public access to the same optimizations.

@TomAugspurger TomAugspurger added API Design Index Related to the Index class or subclasses labels Mar 13, 2019
@jschendel
Copy link
Member

+1, this would additionally make RangeIndex more consistent with the Python 3 range type, which has these attributes publicly available:

In [1]: rng = range(2, 11, 3)

In [2]: rng.start
Out[2]: 2

In [3]: rng.stop
Out[3]: 11

In [4]: rng.step
Out[4]: 3

Will open a PR for this later tonight.

@jschendel jschendel added this to the 0.25.0 milestone Mar 13, 2019
@jorisvandenbossche
Copy link
Member

Personally, I am not really sure we need them (if downstream projects that need it are fine with using the private ones, we can guarantee there stability).

From a user perspective, I think the idea was to have it as a drop in replacement for int index. And you also quickly loose the presence of the RangeIndex, eg by doing a filtering operation, and then at once those attributes don't exist anymore.

But not feeling strongly about it (it's maybe just I would rather see dataframes with an optional index :))

@jschendel
Copy link
Member

jschendel commented Mar 14, 2019

@jorisvandenbossche : I opened a PR to implement this, but I don't have strong feelings either way. Been having power/internet issues today due to a storm, so didn't see the notification for your comment until I basically had all the content of the PR complete. Wouldn't be offended if the PR gets closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Index Related to the Index class or subclasses
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants