TimedeltaIndex.copy()
Pandas TimedeltaIndex.copy()
creates a copy of this TimedeltaIndex object. The function also sets the Name and dtype attributes for the new object.
Syntax: TimedeltaIndex.copy (name = None, deep = False, dtype = None, ** kwargs)
Parameters:
name: string, optional
deep: boolean, default False
dtype: numpy dtype or pandas typeReturn: copy: Index
Example # 1: Use TimedeltaIndex.copy ()
to make a copy of this TimedeltaIndex.
|
Output:
Now we will use TimedeltaIndex.copy ()
to make a copy of the tidx object and set the name of the copied oval object on "New_koala".
|
Output:
As we can see in the output, TimedeltaIndex.copy ()
made a copy of the object, and the function also set the name .
Example # 2: Use TimedeltaIndex.copy ()
to check if a re whether this label is in the index or not.
|
Output:
Now we will use TimedeltaIndex.copy ()
to make a copy of the tidx object, and set the copied object’s name to" New_koala ". We will also change the dtype of the object to str.
|
Output:
As we can see in the output, TimedeltaIndex.copy ()
made a copy of the object and also noticed the dtype of the new object.