Skip to content

Commit 0d7abf3

Browse files
committed
whatsnew and changes requested
1 parent 76cda64 commit 0d7abf3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

doc/source/whatsnew/v0.24.0.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,7 @@ Missing
12151215
MultiIndex
12161216
^^^^^^^^^^
12171217

1218+
- Bug in :func:`io.formats.style.Styler.applymap` where ``subset=`` with :class:`MultiIndex` slice would reduce to :class:`Series` (:issue:`19861`)
12181219
- Removed compatibility for :class:`MultiIndex` pickles prior to version 0.8.0; compatibility with :class:`MultiIndex` pickles from version 0.13 forward is maintained (:issue:`21654`)
12191220
- :meth:`MultiIndex.get_loc_level` (and as a consequence, ``.loc`` on a :class:`MultiIndex`ed object) will now raise a ``KeyError``, rather than returning an empty ``slice``, if asked a label which is present in the ``levels`` but is unused (:issue:`22221`)
12201221
- Fix ``TypeError`` in Python 3 when creating :class:`MultiIndex` in which some levels have mixed types, e.g. when some labels are tuples (:issue:`15457`)

pandas/core/indexing.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2733,11 +2733,10 @@ def _non_reducing_slice(slice_):
27332733
slice_ = IndexSlice[:, slice_]
27342734

27352735
def pred(part):
2736-
# true when slice does *not* reduce False when part is a tuple,
2736+
# true when slice does *not* reduce, False when part is a tuple,
27372737
# i.e. MultiIndex slice
2738-
if isinstance(part, tuple):
2739-
return False
2740-
return isinstance(part, slice) or is_list_like(part)
2738+
return (isinstance(part, slice) or is_list_like(part))\
2739+
and not isinstance(part, tuple)
27412740

27422741
if not is_list_like(slice_):
27432742
if not isinstance(slice_, slice):

0 commit comments

Comments
 (0)