我正在尝试按特定列的值对pandas数据帧的行进行排序,但我不断得到一个我似乎无法弄清楚的错误。我的数据框看起来像这样:
Player PPG \
0 Hassan Whiteside 39.5757
1 James Harden 53.6047
2 Karl-Anthony Towns 41.9976
3 DeMar DeRozan 40.6075
4 Nikola Jokic 30.0971
5 Kyle Lowry 39.94
6 Jonas Valanciunas 26.0737
7 LaMarcus Aldridge 30.9306
8 Julius Randle 29.355
9 Kawhi Leonard 39.2684
10 Jimmy Butler 42.0975
11 Kenneth Faried 22.6171
12 Emmanuel Mudiay 22.5947
13 Brook Lopez 32.1111
14 Goran Dragic 32.1242
15 Pau Gasol 27.6921
16 Ricky Rubio 25.8278
17 Lucas Nogueira 16.7455
18 Andrew Wiggins 30.2854
19 Danilo Gallinari 26.6972
20 Dwyane Wade 31.5108
21 Will Barton 23.7259
22 D'Angelo Russell 27.0781
23 Gorgui Dieng 25.3951
24 James Johnson 23.325
25 Harrison Barnes 30.32
26 Dirk Nowitzki 23.4267
27 Deron Williams 26.225
28 Wilson Chandler 28.0556
29 Robin Lopez 21.5476
我正试图通过这样做来对PPG进行排序:
df_sort = df.sort_values(by='PPG')
它一直在抛出这个错误:
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
我已经尝试了很多调试它没有成功,并且不知道它为什么会产生这个错误。