File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -76,7 +76,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
76
76
-i " pandas.MultiIndex.get_loc_level PR07" \
77
77
-i " pandas.MultiIndex.levshape SA01" \
78
78
-i " pandas.MultiIndex.names SA01" \
79
- -i " pandas.MultiIndex.remove_unused_levels RT03,SA01" \
80
79
-i " pandas.MultiIndex.reorder_levels RT03,SA01" \
81
80
-i " pandas.MultiIndex.set_levels RT03,SA01" \
82
81
-i " pandas.MultiIndex.sortlevel PR07,SA01" \
Original file line number Diff line number Diff line change @@ -2041,9 +2041,22 @@ def remove_unused_levels(self) -> MultiIndex:
2041
2041
appearance, meaning the same .values and ordering. It will
2042
2042
also be .equals() to the original.
2043
2043
2044
+ The `remove_unused_levels` method is useful in cases where you have a
2045
+ MultiIndex with hierarchical levels, but some of these levels are no
2046
+ longer needed due to filtering or subsetting operations. By removing
2047
+ the unused levels, the resulting MultiIndex becomes more compact and
2048
+ efficient, which can improve performance in subsequent operations.
2049
+
2044
2050
Returns
2045
2051
-------
2046
2052
MultiIndex
2053
+ A new MultiIndex with unused levels removed.
2054
+
2055
+ See Also
2056
+ --------
2057
+ MultiIndex.droplevel : Remove specified levels from a MultiIndex.
2058
+ MultiIndex.reorder_levels : Rearrange levels of a MultiIndex.
2059
+ MultiIndex.set_levels : Set new levels on a MultiIndex.
2047
2060
2048
2061
Examples
2049
2062
--------
You can’t perform that action at this time.
0 commit comments