-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Support resetting index with tuple name #16165
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
Codecov Report
@@ Coverage Diff @@
## master #16165 +/- ##
==========================================
+ Coverage 90.87% 90.88% +0.01%
==========================================
Files 162 162
Lines 50816 50806 -10
==========================================
- Hits 46178 46174 -4
+ Misses 4638 4632 -6
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #16165 +/- ##
==========================================
+ Coverage 90.85% 90.86% +0.01%
==========================================
Files 162 162
Lines 50826 50819 -7
==========================================
- Hits 46177 46176 -1
+ Misses 4649 4643 -6
Continue to review full report at Codecov.
|
this looks good. can you add a test which where you have another level already (and check the resetting), e.g.
it works, just want to cover the bases. otherwise lgtm. |
Can you check some more pathological cases? |
The current error is a quite informative " However, it probably makes sense to use |
thanks! |
@toobaz Probably a not so important corner case, but could you also check how this interacts with the |
closes pandas-dev#16164 Author: Pietro Battiston <[email protected]> Closes pandas-dev#16165 from toobaz/reix_col_name and squashes the following commits: 9e1bdba [Pietro Battiston] REF: reorganize reinsertion code 3b0bb1f [Pietro Battiston] ENH: Handle tuples shorter than nlevels gracefully c958de7 [Pietro Battiston] TST: additional test for reset_index with tuple-named index level e12bca1 [Pietro Battiston] ENH: allow tuple index names to be interpreted as full column keys 6315d07 [Pietro Battiston] REF: Avoid duplication in reset_index() when reinsering index columns
git diff master --name-only -- '*.py' | flake8 --diff
Notice the first commit is pure refactoring, and the bug is actually fixed by the one-liner second commit.