1for j in range(len(df.columns)):
2 old = df.columns[j]
3 new = new_columns[j]
4 df = df.rename(columns = {old:new})
1# df is a pandas DataFrame
2
3for col_name in df.columns:
4 # you can specify conditions if you need
5 # to change the name of some column only
6 df = df.rename(columns = {col_name:new_col_name}