python sort dataframe by one column
#following is example of sorting by the column "2" in descending order
final_df = df.sort_values(by=['2'], ascending=False)
python sort dataframe by one column
#following is example of sorting by the column "2" in descending order
final_df = df.sort_values(by=['2'], ascending=False)
sort pandas dataframe by specific column
In [18]:
df.sort_values('2')
Out[18]:
0 1 2
4 85.6 January 1.0
3 95.5 February 2.0
7 104.8 March 3.0
0 354.7 April 4.0
8 283.5 May 5.0
6 238.7 June 6.0
5 152.0 July 7.0
1 55.4 August 8.0
11 212.7 September 9.0
10 249.6 October 10.0
9 278.8 November 11.0
2 176.5 December 12.0
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us