data.index=data['索引列名']方法二:使用.set_index
data.set_index('索引列名', drop= True, inplace=True) # Drop:是否删掉原数据列,inplace:是否修改原dataframe
data.reset_index(drop=True)#drop:是否删掉原来的索引数据
参考链接:
Set_index
Reset_index

data.index=data['索引列名']方法二:使用.set_index
data.set_index('索引列名', drop= True, inplace=True) # Drop:是否删掉原数据列,inplace:是否修改原dataframe
data.reset_index(drop=True)#drop:是否删掉原来的索引数据
参考链接:
Set_index
Reset_index