MCPcopy
hub / github.com/pandas-dev/pandas / maybe_mi_droplevels

Method maybe_mi_droplevels

pandas/core/indexes/multi.py:3659–3669  ·  view source on GitHub ↗

If level does not exist or all levels were dropped, the exception has to be handled outside.

(indexer, levels)

Source from the content-addressed store, hash-verified

3657
3658 # different name to distinguish from maybe_droplevels
3659 def maybe_mi_droplevels(indexer, levels):
3660 """
3661 If level does not exist or all levels were dropped, the exception
3662 has to be handled outside.
3663 """
3664 new_index = self[indexer]
3665
3666 for i in sorted(levels, reverse=True):
3667 new_index = new_index._drop_level_numbers([i])
3668
3669 return new_index
3670
3671 if isinstance(level, (tuple, list)):
3672 if len(key) != len(level):

Callers

nothing calls this directly

Calls 1

_drop_level_numbersMethod · 0.80

Tested by

no test coverage detected