数据重新排列

删除行索引重排:

ser.reset_index(drop = True)

df.reset_index(drop = True)

------------------------------------------

直接修列索引:

df = pd.DataFrame(df,columns = ['One','Two','Three'])
pandas contact 之后,一定要记得用reset_index去处理index,不然容易出现莫名的逻辑错误
直接contact之后索引并没有按照新的数据重新排列。所以需要对索引重排序


猜你喜欢

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