df.rename(columns={'nan': 'RK', 'PP': 'PLAYER','SH':'TEAM','nan':'GP','nan':'G','nan':'A','nan':'PTS','nan':'+/-','nan':'PIM','nan':'PTS/G','nan':'SOG','nan':'PCT','nan':'GWG','nan':'PPG','nan':'PPA','nan':'SHG','nan':'SHA'}, inplace=True)
这是我根据 http://www.espn.com/nhl/statistics/player/_/stat/points/sort/points/year/2015/seasontype/2重命名列的代码
我希望两个表都具有相同的列名。我在 spyder IDE 中使用 python2。
当我运行上面的代码时,它给了我这个错误:
AttributeError: 'list' object has no attribute 'rename'