将后缀添加到pandas dataframe中的列

时间:2017-11-08 10:46:06

标签: python pandas dataframe

如何在Python 3.6的所有数据框列中添加额外的单词/字符

我的数据框有15+列和&我想添加一个单词"代码"数据框中存在所有列的名称。

>>> list(dataAll)

['Active Industry Rep Count', 'Active Reps Count', 'Age Bracket', 'Channel Type', 'Count Reps Changing BDF', 'Deregistration Date During Month', 'Exclude Non Producers', 
'FileName', 'Firm', 'Firm Type', 'Gender', 'License', 'Net Rep Count', 'Quarter End', 'RIA Ownership Type', 'Registration Date During Month', 'Rep Count In', 
'Rep Count Out', 'Retail BD Primary Type', 'Retail BD Type', 'Date', 'Year End', 'Years A Rep', 'value', 'variable', 'Indicator', 'Category', 'Frequency']

现在我要添加"代码"到列以外的所有列:value&频率

ex: dataAll.rename(columns = {'Active Industry Rep Count' : 'Active Industry Rep Count Code'}, inplace = True)

单脚本可以吗?

0 个答案:

没有答案