python dataframe column names rename code example
Example 1: python: change column name
df = df.rename(columns = {'myvar':'myvar_new'})
Example 2: rename column pandas
>>> df.rename(index={0: "x", 1: "y", 2: "z"})
A B
x 1 4
y 2 5
z 3 6