From c394448eb3d06c3aad08c2e2a49d0c931605e138 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Wed, 8 Feb 2017 11:31:18 +0100 Subject: [PATCH 1/2] doc fix for return values of MultiIndex.sortlevel --- pandas/indexes/multi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/indexes/multi.py b/pandas/indexes/multi.py index d2469cf1a3eed..7ca394ad165ab 100644 --- a/pandas/indexes/multi.py +++ b/pandas/indexes/multi.py @@ -1399,7 +1399,7 @@ def sortlevel(self, level=0, ascending=True, sort_remaining=True): Returns ------- - sorted_index : MultiIndex + (sorted_index, index_array) : (MultiIndex, ndarray) """ from pandas.core.groupby import _indexer_from_factorized From 3a3a11a5a3d97a968dc6609691e621f7e6cddd53 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Wed, 8 Feb 2017 15:52:55 +0100 Subject: [PATCH 2/2] MultiIndex.sortlevel docs improved after feedback --- pandas/indexes/multi.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pandas/indexes/multi.py b/pandas/indexes/multi.py index 7ca394ad165ab..9ab07d87fd13b 100644 --- a/pandas/indexes/multi.py +++ b/pandas/indexes/multi.py @@ -1399,7 +1399,11 @@ def sortlevel(self, level=0, ascending=True, sort_remaining=True): Returns ------- - (sorted_index, index_array) : (MultiIndex, ndarray) + sorted_index : pd.MultiIndex + Resulting index + indexer : np.ndarray + Indices of output values in original index + """ from pandas.core.groupby import _indexer_from_factorized