问题
I have a Python Pandas Data Frame. The df has 2 columns, I would like to sort the df by the second column.
Kappa_prod Angle
0 0.004511 -5.457840
1 0.003977 -5.312861
2 0.004476 -5.311292
3 0.003644 -117.579594
4 0.003306 -117.542817
I would like to sort the df by Angle (ascending order).
回答1:
You can use this:
df.sort_values("Angle", inplace=True)
By default ascending=True is passed to the above call. For more information check the documentation here.
来源:https://stackoverflow.com/questions/46072509/pandas-dataframe-sort-by-a-column