Index.
droplevel
Return index with requested level(s) removed. If resulting index has only 1 level left, the result will be of Index type, not MultiIndex.
If a string is given, must be the name of a level If list-like, elements must be names or indexes of levels.
Examples
>>> midx = ps.DataFrame({'a': ['a', 'b']}, index=[['a', 'x'], ['b', 'y'], [1, 2]]).index >>> midx MultiIndex([('a', 'b', 1), ('x', 'y', 2)], ) >>> midx.droplevel([0, 1]) Int64Index([1, 2], dtype='int64') >>> midx.droplevel(0) MultiIndex([('b', 1), ('y', 2)], ) >>> midx.names = [("a", "b"), "b", "c"] >>> midx.droplevel([('a', 'b')]) MultiIndex([('b', 1), ('y', 2)], names=['b', 'c'])