# 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)