Examples
import numpy as np
import pandas as pd
df = pd.DataFrame({"num_legs": [4, 4, 2],
"num_arms": [0, 0, 2]},
["fox", "deer", "Kangaroo"])
df
df = df.rename_axis("animal")
df
df = df.rename_axis("limbs", axis="columns")
df
MultiIndex
df.index = pd.MultiIndex.from_product([['mammal'],
['fox', 'deer', 'Kangaroo']],
names=['type', 'name'])
df
df.rename_axis(index={'type': 'class'})
df.rename_axis(columns=str.upper)