df
Change names of specific columns.
df.rename(columns={"a":"A", "b":"B"})
df.rename({"a":"A", "b":"B"}, axis="columns")
df.rename({"a":"A", "b":"B"}, axis=1)
Change columns names using a function.
df.rename(columns=str.upper)
df.rename(mapper=str.upper, axis='columns')
df.rename(mapper=str.upper, axis=1)
Rename column and index labels.
df.rename(columns={"a":"A", "b":"B", "c":"C"},
index={0:10, 1:20, 2:30})
df.rename(columns=str.upper,
index=lambda x: (x + 1) * 10)