Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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}
 
PREVIOUS NEXT
Tagged: #pandas #rename #multiple #columns
ADD COMMENT
Topic
Name
2+8 =