pyspark.pandas.MultiIndex.drop

MultiIndex.drop(codes: List[Any], level: Union[int, Any, Tuple[Any, …], None] = None) → pyspark.pandas.indexes.multi.MultiIndex[source]

Make new MultiIndex with passed list of labels deleted

Parameters
codesarray-like

Must be a list of tuples

levelint or level name, default None
Returns
droppedMultiIndex

Examples

>>> index = ps.MultiIndex.from_tuples([('a', 'x'), ('b', 'y'), ('c', 'z')])
>>> index 
MultiIndex([('a', 'x'),
            ('b', 'y'),
            ('c', 'z')],
           )
>>> index.drop(['a']) 
MultiIndex([('b', 'y'),
            ('c', 'z')],
           )
>>> index.drop(['x', 'y'], level=1) 
MultiIndex([('c', 'z')],
           )