reset_index() 对pandas重置reset_index()

对pandas重置reset_index()


reset_index将索引恢复成数据列后,该列的名称显示为index,但是我用df['index']提取这列数据时,却提示KeyError: 'index'。请问要如何才能取到这列数,以及如何向这列赋予一个新的列名?谢谢
df.rename({"原列名":"新列名"}, inplace=True)

猜你喜欢

转载自blog.csdn.net/erinapple/article/details/80302847