所以,我有一個像這樣的熊貓數據框:
id, counts
1, 20
1, 21
1,15
1, 24
2,12
2,42
2,9
3,43
...
id, counts, label
1, 20, 0
1, 21, 0
1,15, 0
1, 24, 1 # because 24 is the highest count for id 1
2,12, 0
2,42, 1 # because 42 is the highest count for id 2
2,9, 0
3,43,
...
我如何在使用熊貓中做到這一點