Skip to content

Conversation

@topper-123
Copy link
Contributor

@topper-123 topper-123 commented May 30, 2019

Make RangeIndex use python's range internally, rather than the three scalars _start, _stop and _step.

Python3's range has several nice properties, that were not available in xrange in Python2. For example it's sliceable, and has .index and count and various magic methods. These can be used in Pandas, rather than maintaining Pandas-specific code, offering cleaner code and possibly faster operations.

@codecov
Copy link

codecov bot commented May 30, 2019

Codecov Report

Merging #26578 into master will decrease coverage by 0.12%.
The diff coverage is 37.83%.

Impacted file tree graph

@@ Coverage Diff @@ ## master #26578 +/- ## ========================================== - Coverage 41.79% 41.67% -0.13%  ========================================== Files 174 174 Lines 50643 50617 -26 ========================================== - Hits 21168 21094 -74  - Misses 29475 29523 +48
Flag Coverage Δ
#single 41.67% <37.83%> (-0.13%) ⬇️
Impacted Files Coverage Δ
pandas/io/packers.py 14.53% <ø> (ø) ⬆️
pandas/core/indexes/range.py 49.68% <32.81%> (-2.49%) ⬇️
pandas/core/dtypes/concat.py 52.19% <70%> (-1.24%) ⬇️
pandas/io/gbq.py 15.78% <0%> (-57.9%) ⬇️
pandas/io/formats/csvs.py 68.07% <0%> (-1.21%) ⬇️
pandas/util/testing.py 50.89% <0%> (-1.06%) ⬇️
pandas/io/formats/format.py 50.23% <0%> (-0.94%) ⬇️
pandas/core/internals/blocks.py 51.93% <0%> (-0.83%) ⬇️
pandas/core/dtypes/cast.py 48.59% <0%> (-0.34%) ⬇️
pandas/core/arrays/datetimelike.py 42.78% <0%> (-0.18%) ⬇️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7c8041b...6b15312. Read the comment docs.

@codecov
Copy link

codecov bot commented May 30, 2019

Codecov Report

Merging #26578 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@ Coverage Diff @@ ## master #26578 +/- ## ========================================== - Coverage 91.84% 91.84% -0.01%  ========================================== Files 174 174 Lines 50643 50624 -19 ========================================== - Hits 46515 46494 -21  - Misses 4128 4130 +2
Flag Coverage Δ
#multiple 90.37% <100%> (ø) ⬆️
#single 41.69% <36.7%> (-0.11%) ⬇️
Impacted Files Coverage Δ
pandas/io/packers.py 88.08% <ø> (ø) ⬆️
pandas/core/series.py 93.61% <ø> (ø) ⬆️
pandas/core/frame.py 97% <ø> (-0.12%) ⬇️
pandas/core/dtypes/concat.py 96.58% <100%> (+0.01%) ⬆️
pandas/core/indexes/range.py 98.46% <100%> (+0.49%) ⬆️
pandas/io/gbq.py 78.94% <0%> (-10.53%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7c8041b...6b15312. Read the comment docs.

@topper-123 topper-123 added Index Related to the Index class or subclasses Clean labels May 30, 2019
@topper-123 topper-123 added this to the 0.25.0 milestone May 30, 2019
.. deprecated:: 0.25.0
Use ._range.start or .start instead.
"""
return self._range.start
Copy link
Contributor Author

@topper-123 topper-123 May 30, 2019

Choose a reason for hiding this comment

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

Unfortunately, fast_parquet uses _start etc. which I hadn't predicted, when I started this PR. So this proposes deprecating the attributes _start, _stop and _step, and removing them in 1.0.

Thuis can be bit of a nuisance for upstream maintainers, so don't know if there's opposition to this, but this PR has several benefits also, so there's a trade-off.

@topper-123
Copy link
Contributor Author

Some problems, closing temporqrily.

@topper-123 topper-123 closed this May 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Clean Index Related to the Index class or subclasses

1 participant