Renaming columns in pandas

前端 未结 27 3065
野性不改
野性不改 2020-11-21 07:05

I have a DataFrame using pandas and column labels that I need to edit to replace the original column labels.

I\'d like to change the column names in a DataFrame

27条回答
  •  庸人自扰
    2020-11-21 07:35

    Renaming columns in pandas is an easy task.

    df.rename(columns={'$a': 'a', '$b': 'b', '$c': 'c', '$d': 'd', '$e': 'e'}, inplace=True)
    

提交回复
热议问题