Skip to content

Commit 2e82d78

Browse files
author
Minh Phan
committed
Fix DataFrame/Series stack/unstack docs
1 parent 7d0ee96 commit 2e82d78

File tree

3 files changed

+1
-6
lines changed

3 files changed

+1
-6
lines changed

doc/source/whatsnew/v1.1.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,7 @@ MultiIndex
966966
left.intersection(right, sort=False)
967967
968968
- Bug when joining 2 Multi-indexes, without specifying level with different columns. Return-indexers parameter is ignored. (:issue:`34074`)
969+
- Bug in :meth:`DataFrame.stack`, :meth:`DataFrame.unstack`, :meth:`Series.unstack` where the level involved is not always sorted (:issue:`21675`)
969970

970971
I/O
971972
^^^

pandas/core/frame.py

-4
Original file line numberDiff line numberDiff line change
@@ -6739,8 +6739,6 @@ def stack(self, level=-1, dropna=True):
67396739
level(s) is (are) taken from the prescribed level(s) and
67406740
the output is a DataFrame.
67416741
6742-
The new index levels are sorted.
6743-
67446742
Parameters
67456743
----------
67466744
level : int, str, list, default -1
@@ -6976,8 +6974,6 @@ def unstack(self, level=-1, fill_value=None):
69766974
If the index is not a MultiIndex, the output will be a Series
69776975
(the analogue of stack when the columns are not a MultiIndex).
69786976
6979-
The level involved will automatically get sorted.
6980-
69816977
Parameters
69826978
----------
69836979
level : int, str, or list of these, default -1 (last level)

pandas/core/series.py

-2
Original file line numberDiff line numberDiff line change
@@ -3823,8 +3823,6 @@ def unstack(self, level=-1, fill_value=None):
38233823
"""
38243824
Unstack, also known as pivot, Series with MultiIndex to produce DataFrame.
38253825
3826-
The level involved will automatically get sorted.
3827-
38283826
Parameters
38293827
----------
38303828
level : int, str, or list of these, default last level

0 commit comments

Comments
 (0)