-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Should not raise errors in .set_names for MultiIndex with nlevels == 1 (GH21149) #21196
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
Conversation
Updating to 0.23.0
Update 18 May
24 May fork update
GH21149-2
Codecov Report
@@ Coverage Diff @@
## master #21196 +/- ##
=========================================
Coverage ? 91.84%
=========================================
Files ? 153
Lines ? 49506
Branches ? 0
=========================================
Hits ? 45467
Misses ? 4039
Partials ? 0
Continue to review full report at Codecov.
|
doc/source/whatsnew/v0.23.1.txt
Outdated
@@ -78,7 +78,8 @@ Indexing | |||
|
|||
- Bug in :meth:`Series.reset_index` where appropriate error was not raised with an invalid level name (:issue:`20925`) | |||
- Bug in :func:`interval_range` when ``start``/``periods`` or ``end``/``periods`` are specified with float ``start`` or ``end`` (:issue:`21161`) | |||
- | |||
- Bug in :meth:`MultiIndex.set_names` where error raised for a MultiIndex with self.nlevels == 1 (:issue:`21149`) |
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.
just say nlevels == 1
(in double backticks)
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.
Thanks - done
pandas/tests/indexes/test_multi.py
Outdated
@@ -165,6 +165,18 @@ def test_set_name_methods(self): | |||
assert res is None | |||
assert ind.names == new_names2 | |||
|
|||
def test_multiindex_set_names(self): | |||
# GH 21149 | |||
'''Ensure that .set_names for MultiIndex with |
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.
use triple-double quotes
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
pandas/tests/indexes/test_multi.py
Outdated
nlevels == 1 does not raise any errors | ||
''' | ||
result = pd.MultiIndex.from_product([[0, 1]]) | ||
result.set_names('first', level=0, inplace=True) |
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.
test both inplace=True and False with a parameterized test
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
thanks @KalyanGokhale certainly love for you to kill the nlevels==1 checks in the rest of the code base :> |
Thanks @jreback - will comb through the codes for other nlevels==1 instances and would work on it |
…s == 1 (GH21149) (pandas-dev#21196) (cherry picked from commit a5259cc)
git diff upstream/master -u -- "*.py" | flake8 --diff
Initial PR #21182 is closed - and now split in 2 different PRs