Skip to content

Commit 3d3b80f

Browse files
committed
whatsnew and changes requested
1 parent 3bcb402 commit 3d3b80f

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
@@ -1327,6 +1327,7 @@ Missing
13271327
MultiIndex
13281328
^^^^^^^^^^
13291329

1330+
- Bug in :func:`io.formats.style.Styler.applymap` where ``subset=`` with :class:`MultiIndex` slice would reduce to :class:`Series` (:issue:`19861`)
13301331
- 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`)
13311332
- :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`)
13321333
- 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

+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)