Skip to content

Commit 828b6d0

Browse files
DOC: fix RT03,SA01,ES01 for pandas.MultiIndex.reorder_levels (#59658)
1 parent e4956ab commit 828b6d0

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

ci/code_checks.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
7070
--format=actions \
7171
-i ES01 `# For now it is ok if docstrings are missing the extended summary` \
7272
-i "pandas.Series.dt PR01" `# Accessors are implemented as classes, but we do not document the Parameters section` \
73-
-i "pandas.MultiIndex.reorder_levels RT03,SA01" \
7473
-i "pandas.NA SA01" \
7574
-i "pandas.NaT SA01" \
7675
-i "pandas.Period.freq GL08" \

pandas/core/indexes/multi.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2604,6 +2604,13 @@ def reorder_levels(self, order) -> MultiIndex:
26042604
"""
26052605
Rearrange levels using input order. May not drop or duplicate levels.
26062606
2607+
`reorder_levels` is useful when you need to change the order of levels in
2608+
a MultiIndex, such as when reordering levels for hierarchical indexing. It
2609+
maintains the integrity of the MultiIndex, ensuring that all existing levels
2610+
are present and no levels are duplicated. This method is helpful for aligning
2611+
the index structure with other data structures or for optimizing the order
2612+
for specific data operations.
2613+
26072614
Parameters
26082615
----------
26092616
order : list of int or list of str
@@ -2613,6 +2620,13 @@ def reorder_levels(self, order) -> MultiIndex:
26132620
Returns
26142621
-------
26152622
MultiIndex
2623+
A new MultiIndex with levels rearranged according to the specified order.
2624+
2625+
See Also
2626+
--------
2627+
MultiIndex.swaplevel : Swap two levels of the MultiIndex.
2628+
MultiIndex.set_names : Set names for the MultiIndex levels.
2629+
DataFrame.reorder_levels : Reorder levels in a DataFrame with a MultiIndex.
26162630
26172631
Examples
26182632
--------

0 commit comments

Comments
 (0)