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

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

Closed
TomAugspurger opened this issue Mar 13, 2019 · 3 comments

Comments

@TomAugspurger
Copy link
Contributor

commented Mar 13, 2019

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.

@jschendel

This comment has been minimized.

Copy link
Member

commented Mar 13, 2019

+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

This comment has been minimized.

Copy link
Member

commented Mar 13, 2019

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

This comment has been minimized.

Copy link
Member

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
Projects
None yet
3 participants
You can’t perform that action at this time.