-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
ENH: Make RangeIndex.append() return RangeIndex when possible #16213
Conversation
Codecov Report
@@ Coverage Diff @@
## master #16213 +/- ##
==========================================
- Coverage 90.89% 90.87% -0.02%
==========================================
Files 162 162
Lines 50884 50915 +31
==========================================
+ Hits 46250 46269 +19
- Misses 4634 4646 +12
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #16213 +/- ##
==========================================
- Coverage 90.35% 90.34% -0.01%
==========================================
Files 161 161
Lines 50866 50897 +31
==========================================
+ Hits 45962 45985 +23
- Misses 4904 4912 +8
Continue to review full report at Codecov.
|
doc/source/whatsnew/v0.20.0.txt
Outdated
@@ -508,6 +508,7 @@ Other Enhancements | |||
- Compatability with Jupyter notebook 5.0; MultiIndex column labels are left-aligned and MultiIndex row-labels are top-aligned (:issue:`15379`) | |||
|
|||
- ``TimedeltaIndex`` now has a custom datetick formatter specifically designed for nanosecond level precision (:issue:`8711`) | |||
- ``RangeIndex.append`` now returns a ``RangeIndex`` object when possible (:issue:`16212`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move to 0.20.1
""" | ||
Append a collection of Index options together | ||
|
||
Parameters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, yeah any way to share some code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, more or less ready, but it involves many more changes/files and probably some discussion, if it's OK I will open another PR immediately after this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can simply put up another PR which bases on this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to fix one error, then I will
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see #16236
doc/source/whatsnew/v0.20.1.txt
Outdated
@@ -18,6 +18,7 @@ Highlights include: | |||
|
|||
Enhancements | |||
~~~~~~~~~~~~ | |||
- ``RangeIndex.append`` now returns a ``RangeIndex`` object when possible (:issue:`16212`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move to 0.21.0
4f8762d
to
7b3cecb
Compare
The last push just makes few lines of the tests nicer |
@@ -941,3 +941,38 @@ def test_where_array_like(self): | |||
for klass in klasses: | |||
result = i.where(klass(cond)) | |||
tm.assert_index_equal(result, expected) | |||
|
|||
def test_append(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add the issue number as comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(done)
ok, fine to merge. ping on green. |
ping |
thanks! |
git diff master --name-only -- '*.py' | flake8 --diff
This is analogous to what is already done for
RangeIndex.union()
, but there doesn't seem to be much scope for code reuse (what could be, in principle, reused in.append
of allIndex
subclasses is the initial casting to list/name handling, I could do in a separate PR).