pandas.MultiIndex.copy
- MultiIndex.copy(names=None, deep=False, name=None)[source]
-
Make a copy of this object.
Names, dtype, levels and codes can be passed and will be set on new copy.
- Parameters:
-
- names:sequence, optional
- deep:bool, default False
- name:Label
-
Kept for compatibility with 1-dimensional Index. Should not be used.
- Returns:
-
- MultiIndex
Notes
In most cases, there should be no functional difference from using
deep
, but ifdeep
is passed it will attempt to deepcopy. This could be potentially expensive on large MultiIndex objects.Examples
>>> mi = pd.MultiIndex.from_arrays([['a'], ['b'], ['c']]) >>> mi MultiIndex([('a', 'b', 'c')], ) >>> mi.copy() MultiIndex([('a', 'b', 'c')], )
© 2008–2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
© 2011–2025, Open source contributors
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/2.3.0/reference/api/pandas.MultiIndex.copy.html