Change language

Python | Pandas TimedeltaIndex.rename

| |

TimedeltaIndex.rename() Pandas TimedeltaIndex.rename() sets new names in the index. By default, the new index is returned.

Syntax: TimedeltaIndex.rename (name, inplace = False)

Parameters: None
name: [str or list] name to set
inplace: if True, mutates in place

Return: new index (of same type and class… etc) [if inplace, returns None]

Example # 1: Use TimedeltaIndex.rename () to rename this TimedeltaIndex object.

# import pandas as pd

import pandas as pd

 
# Create TimedeltaIndex object

tidx = pd.TimedeltaIndex (data  = [ ’06: 05: 01.000030’ , None , ’22 day 2 min 3us 10ns’ ,

’ +23: 59: 59.999999’ , None , ’+12: 19: 59.999999’ ], name = ’Old’ )

  
# Print the TimedeltaIndex object

print (tidx)

Output:

Now we will We can use TimedeltaIndex.rename () to rename the tidx object.

# rename the tidx object

tidx.rename (name = ’New_object’ )

Exit:

As we can see from the output, TimedeltaIndex.rename () returned a new index and set the name attribute of the TimedeltaIndex object.

Example # 2: Use TimedeltaIndex.rename () to rename this a TimedeltaIndex object.

# import pandas as pd

import pandas as pd

 
# Create TimedeltaIndex object

tidx = pd.TimedeltaIndex (data = [ None , ’1 days 06: 05: 01.000030’ , None , ’1 days 02: 00: 00’ ,

’21 days 06: 15: 01.000030’ ], name = ’Old_object’ )

 
# Print the TimedeltaIndex object

print (tidx)

Output:

We will now use TimedeltaIndex.rename () to rename the tidx object.

# rename the tidx object

tidx.rename (name = ’ New_object’ )

Output:

As we can see from the output, TimedeltaIndex.rename () returned a new index and set the name attribute of the TimedeltaIndex object.

Python | Pandas TimedeltaIndex.rename __del__: Questions

Python | Pandas TimedeltaIndex.rename Python functions: Questions

Shop

Best laptop for Fortnite

$

Best laptop for Excel

$

Best laptop for Solidworks

$

Best laptop for Roblox

$

Best computer for crypto mining

$

Best laptop for Sims 4

$

Best laptop for Zoom

$499

Best laptop for Minecraft

$590

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

News

Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method