-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
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
Include MultiIndex slice in non-reducing slices #19881
Include MultiIndex slice in non-reducing slices #19881
Conversation
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 original example (e.g. with the full style usage) as a tests (in the style tests), just as a smoke that it doesn't raise is ok.
also pls add a whatsnew note (bug fix, multiindex is ok) |
Codecov Report
@@ Coverage Diff @@
## master #19881 +/- ##
==========================================
- Coverage 92.32% 92.32% -0.01%
==========================================
Files 166 166
Lines 52440 52429 -11
==========================================
- Hits 48417 48404 -13
- Misses 4023 4025 +2
Continue to review full report at Codecov.
|
Thanks for review, changed as requested, but still two minor questions for clarification (comment) |
this got a bit lost. can you rebase and move the note to 0.24.0 |
2370e0b
to
eaa9dba
Compare
Hello @fleimgruber! Thanks for updating the PR. Cheers ! There are no PEP8 issues in this Pull Request. 🍻 Comment last updated on January 02, 2019 at 00:28 Hours UTC |
eaa9dba
to
0d7abf3
Compare
Rebased and whatsnew 0.24.0. |
@fleimgruber mind rebasing and resolving the conflicts above. ( The build issues on azure you are seeing is resolved on master ) |
da6c250
to
3d3b80f
Compare
@alimcmaster1 rebased. Which conflicts were you referring to? Still failing on Azure - a new bug? |
@fleimgruber thanks ( you have resolved the conflicts now ). It appears to be a flakey test, i've raised a PR here #23849 to hopefully fix the problem |
@jreback @gfyoung @mroeschke does someone mind restarting the azure 27 build on this PR - seems to be a flakey test. Im look in #23849 |
pls merge master |
3d3b80f
to
10976fd
Compare
Rebased on master. |
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.
One small note otherwise LGTM.
pandas/core/indexing.py
Outdated
return isinstance(part, slice) or is_list_like(part) | ||
# true when slice does *not* reduce, False when part is a tuple, | ||
# i.e. MultiIndex slice | ||
return (isinstance(part, slice) or is_list_like(part))\ |
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.
We are moving away from using \
line breaks in the codebase. Could you wrap this condition in parenthesis instead?
@@ -274,6 +274,31 @@ def f(x): | |||
col in self.df.loc[slice_].columns} | |||
assert result == expected | |||
|
|||
def test_applymap_subset_multiindex(self): | |||
# https://github.com/pandas-dev/pandas/issues/19861 |
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 leave a comment that this is just a smoke test.
@fleimgruber can you update for comments |
Changes behaviour of user-passed IndexSlice to return DataFrame instead of reducing to Series. MultiIndex slices are tuples so this explicitly checks type and guards with parentheses. Fixes pandas-dev#19861
5b5cdd8
to
a00dd9e
Compare
thanks @fleimgruber |
* upstream/master: Include MultiIndex slice in non-reducing slices (pandas-dev#19881)
Changes behaviour of user-passed IndexSlice to return DataFrame instead of
reducing to Series. MultiIndex slices are tuples so this explicitly checks type
and guards with braces.
This seems deceptively simple. WDYT?
git diff upstream/master -u -- "*.py" | flake8 --diff