-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TST: add test cases for reset_index method #23116
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
Hello @minggli! Thanks for submitting the PR.
|
there are 2 issues pointed out in the OP the first should already be fixed (and was a bug) to answer your question, yes we want to be consistent in this |
@jreback thanks for commenting! it seems it has indeed been fixed already. closing this PR. |
would take tests for this though! |
81f64df
to
ddd4b6a
Compare
strangely, it appears that below would fail on master: s = pd.Series([1, 2, 3], index=pd.Index(range(3), name='x'))
assert s.reset_index().index.name == 'x'
assert s.reset_index(drop=True).index.name == 'x' i hope I understood the issue correctly, is it expected for the reset index to carry over the index name? |
these both look correct to me, the index name should not be carried over. |
Codecov Report
@@ Coverage Diff @@
## master #23116 +/- ##
==========================================
+ Coverage 92.19% 92.82% +0.62%
==========================================
Files 169 169
Lines 50950 55686 +4736
==========================================
+ Hits 46975 51689 +4714
- Misses 3975 3997 +22
Continue to review full report at Codecov.
|
@jreback reflected your comment in added tests. |
9ce663b
to
2cfd37f
Compare
thanks @minggli |
git diff upstream/master -u -- "*.py" | flake8 --diff
the fix appears to work but it breaks previous assert_frame_equal that assumes index.name == None after reset_index() call.
The question remains that is the issue #17067 actually a bug and does it require a fix at all? user can pretty much do
series.index.name = 'new name'
to handle this problem.