pandas.Index.copy#
- Index.copy(name=None, deep=False)[source]#
Make a copy of this object.
Name is set on the new object.
- Parameters:
- nameLabel, optional
Set name for new object.
- deepbool, default False
- If True attempts to make a deep copy of the Index.
Else makes a shallow copy.
- Returns:
- Index
Index refer to new object which is a copy of this object.
See also
Index.deleteMake new Index with passed location(-s) deleted.
Index.dropMake new Index with passed list of labels deleted.
Notes
In most cases, there should be no functional difference from using
deep, but ifdeepis passed it will attempt to deepcopy.Examples
>>> idx = pd.Index(["a", "b", "c"]) >>> new_idx = idx.copy() >>> idx is new_idx False