Answers for "pandas rename two columns with same name"

1

pandas rename multiple columns

# df is a pandas DataFrame

for col_name in df.columns:
  # you can specify conditions if you need 
  # to change the name of some column only
  df = df.rename(columns = {col_name:new_col_name}
Posted by: Guest on May-31-2021

Code answers related to "pandas rename two columns with same name"

Python Answers by Framework

Browse Popular Code Answers by Language