Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

dataframe index rename

# For index name:
df = df.rename(index={'old_name': 'new_name'})
# or
df.index = df.index.rename('new_name')
# or 
df.index.rename('new_name', inplace=True)

# For column name:
df = df.rename(columns={'old_name': 'new_name'})
#
df.columns = df.columns.rename('new_name')
# or
df.columns.rename('new_name', inplace=True)
 
PREVIOUS NEXT
Tagged: #dataframe #index #rename
ADD COMMENT
Topic
Name
2+3 =