Python 3.x 在数据帧Python 3.7中重命名列时出现问题

Python 3.x 在数据帧Python 3.7中重命名列时出现问题,python-3.x,pandas,dataframe,rename,Python 3.x,Pandas,Dataframe,Rename,我有以下专栏,希望将“Stores\u num”更改为“Stores\u num” data.columns Out[240]: Index(['INV_NUMBER', 'Store_num', 'Description', 'Price', 'Sold', 'Del', 'Sales', 'Tot_Sls', 'Unit_Cost', 'Cost', 'Cost_Percent', 'Margin', 'Profit', 'Date', 'Year', 'Mon

我有以下专栏,希望将“Stores\u num”更改为“Stores\u num”

data.columns
Out[240]: 
Index(['INV_NUMBER', 'Store_num', 'Description', 'Price', 'Sold', 'Del',
       'Sales', 'Tot_Sls', 'Unit_Cost', 'Cost', 'Cost_Percent', 'Margin',
       'Profit', 'Date', 'Year', 'Month', 'Day'],
      dtype='object')
我使用以下代码:

data.rename(columns={'Stores_num':'Stores_Num'},inplace=True)

data.columns
Out[242]: 
Index(['INV_NUMBER', 'Store_num', 'Description', 'Price', 'Sold', 'Del',
       'Sales', 'Tot_Sls', 'Unit_Cost', 'Cost', 'Cost_Percent', 'Margin',
       'Profit', 'Date', 'Year', 'Month', 'Day'],
      dtype='object')
正如您看到的,列名“Stores_num”没有更改。
这里出了什么问题。

代码中没有任何错误。看起来您正在使用Jupyter笔记本运行代码。以前的数据可能存储在缓存中,请重新启动并运行所有单元格。它应该解决这个问题。谢谢

'Store\u num'
不是
'Stores\u num'
哦,废话。。。我的眼睛背叛了我。。。