pyspark.pandas.MultiIndex.copy

MultiIndex.copy(deep: Optional[bool] = None) → pyspark.pandas.indexes.multi.MultiIndex

Make a copy of this object.

Parameters
deepNone

this parameter is not supported but just dummy parameter to match pandas.

Examples

>>> df = ps.DataFrame([(.2, .3), (.0, .6), (.6, .0), (.2, .1)],
...                   columns=['dogs', 'cats'],
...                   index=[list('abcd'), list('efgh')])
>>> df['dogs'].index  
MultiIndex([('a', 'e'),
            ('b', 'f'),
            ('c', 'g'),
            ('d', 'h')],
           )

Copy index

>>> df.index.copy()  
MultiIndex([('a', 'e'),
            ('b', 'f'),
            ('c', 'g'),
            ('d', 'h')],
           )