On this page
pandas.Index.copy
- Index.copy(name=None, deep=False, dtype=None, names=None)[source]
-
Make a copy of this object.
Name and dtype sets those attributes on the new object.
- Parameters
-
- name:Label, optional
-
Set name for new object.
- deep:bool, default False
- dtype:numpy dtype or pandas type, optional
-
Set dtype for new object.
Deprecated since version 1.2.0: use
astype
method instead. - names:list-like, optional
-
Kept for compatibility with MultiIndex. Should not be used.
Deprecated since version 1.4.0: use
name
instead.
- Returns
-
- Index
-
Index refer to new object which is a copy of this object.
Notes
In most cases, there should be no functional difference from using
deep
, but ifdeep
is passed it will attempt to deepcopy.
© 2008–2022, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/1.5.0/reference/api/pandas.Index.copy.html