Skip to content

DOC: fix RT03,SA01,ES01 for pandas.MultiIndex.reorder_levels #59658

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
--format=actions \
-i ES01 `# For now it is ok if docstrings are missing the extended summary` \
-i "pandas.Series.dt PR01" `# Accessors are implemented as classes, but we do not document the Parameters section` \
-i "pandas.MultiIndex.reorder_levels RT03,SA01" \
-i "pandas.NA SA01" \
-i "pandas.NaT SA01" \
-i "pandas.Period.freq GL08" \
Expand Down
14 changes: 14 additions & 0 deletions pandas/core/indexes/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2604,6 +2604,13 @@ def reorder_levels(self, order) -> MultiIndex:
"""
Rearrange levels using input order. May not drop or duplicate levels.

`reorder_levels` is useful when you need to change the order of levels in
a MultiIndex, such as when reordering levels for hierarchical indexing. It
maintains the integrity of the MultiIndex, ensuring that all existing levels
are present and no levels are duplicated. This method is helpful for aligning
the index structure with other data structures or for optimizing the order
for specific data operations.

Parameters
----------
order : list of int or list of str
Expand All @@ -2613,6 +2620,13 @@ def reorder_levels(self, order) -> MultiIndex:
Returns
-------
MultiIndex
A new MultiIndex with levels rearranged according to the specified order.

See Also
--------
MultiIndex.swaplevel : Swap two levels of the MultiIndex.
MultiIndex.set_names : Set names for the MultiIndex levels.
DataFrame.reorder_levels : Reorder levels in a DataFrame with a MultiIndex.

Examples
--------
Expand Down
Loading