Skip to content

Commit 7fb060d

Browse files
author
Jean-Francois Zinque
committed
DOC: whatsnew for #31325
1 parent 0fb0951 commit 7fb060d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

doc/source/whatsnew/v1.1.0.rst

+10
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,16 @@ MultiIndex
175175
index=[["a", "a", "b", "b"], [1, 2, 1, 2]])
176176
# Rows are now ordered as the requested keys
177177
df.loc[(['b', 'a'], [2, 1]), :]
178+
179+
- Bug in :meth:`MultiIndex.intersection` was not preserving order when ``sort=False``. (:issue:`31325`)
180+
181+
.. ipython:: python
182+
183+
left = pd.MultiIndex.from_arrays([["b", "a"], [2, 1]])
184+
right = pd.MultiIndex.from_arrays([["a", "b", "c"], [1, 2, 3]])
185+
# Common elements are now ordered by the left side
186+
left.intersection(right, sort=False)
187+
178188
-
179189

180190
I/O

0 commit comments

Comments
 (0)