Skip to content

Commit 10976fd

Browse files
committed
whatsnew and changes requested
1 parent b1e1b21 commit 10976fd

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

doc/source/whatsnew/v0.24.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -1460,6 +1460,7 @@ Missing
14601460
MultiIndex
14611461
^^^^^^^^^^
14621462

1463+
- Bug in :func:`io.formats.style.Styler.applymap` where ``subset=`` with :class:`MultiIndex` slice would reduce to :class:`Series` (:issue:`19861`)
14631464
- 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`)
14641465
- :meth:`MultiIndex.get_loc_level` (and as a consequence, ``.loc`` on a ``Series`` or ``DataFrame`` with a :class:`MultiIndex` index) 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`)
14651466
- :class:`MultiIndex` has gained the :meth:`MultiIndex.from_frame`, it allows constructing a :class:`MultiIndex` object from a :class:`DataFrame` (:issue:`22420`)

pandas/core/indexing.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -2732,11 +2732,10 @@ def _non_reducing_slice(slice_):
27322732
slice_ = IndexSlice[:, slice_]
27332733

27342734
def pred(part):
2735-
# true when slice does *not* reduce False when part is a tuple,
2735+
# true when slice does *not* reduce, False when part is a tuple,
27362736
# i.e. MultiIndex slice
2737-
if isinstance(part, tuple):
2738-
return False
2739-
return isinstance(part, slice) or is_list_like(part)
2737+
return (isinstance(part, slice) or is_list_like(part))\
2738+
and not isinstance(part, tuple)
27402739

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

0 commit comments

Comments
 (0)