我遇到问题时,想按列对数据框进行排序
df = pd.DataFrame(np.random.random(5))
df.sort(columns = [0],inplace = True)
df
0
4 0.275867
1 0.304362
2 0.625837
0 0.741176
3 0.767829
Run Code Online (Sandbox Code Playgroud)
当我对列进行排序时,得到的结果不是我所期望的,我期望索引仍应为0、1、2、3、4,所以我如何获得该结果并使列0保持升序。