Calculate the mean value of each object on dataframe

I want to calculate the mean value of each object on this dataframe:

index detection_class_names detection_class_entities detection_class_labels detection_scores
0 /m/01g317 Person 69 0.7965893
1 /m/01g317 Person 69 0.7868858
2 /m/01g317 Person 69 0.785902
3 /m/01g317 Person 69 0.77137744
4 /m/01g317 Person 69 0.770353
5 /m/01g317 Person 69 0.7686965
6 /m/01g317 Person 69 0.7597503
7 /m/01g317 Person 69 0.75952464
8 /m/01g317 Person 69 0.7312174
9 /m/01g317 Person 69 0.69465923
10 /m/01g317 Person 69 0.6754475
11 /m/01g317 Person 69 0.63933325
12 /m/01g317 Person 69 0.5939468
13 /m/01g317 Person 69 0.54122645
14 /m/01g317 Person 69 0.47619903
15 /m/01g317 Person 69 0.3954147
16 /m/01g317 Person 69 0.24747418
17 /m/04yx4 Man 308 0.21528831
18 /m/01g317 Person 69 0.19553629
19 /m/01g317 Person 69 0.18318504
20 /m/01g317 Person 69 0.17788896
21 /m/01g317 Person 69 0.16685289
22 /m/01g317 Person 69 0.15162204
23 /m/04yx4 Man 308 0.14820576
24 /m/01g317 Person 69 0.14413418
25 /m/01g317 Person 69 0.12246804
26 /m/04yx4 Man 308 0.11826622
27 /m/04yx4 Man 308 0.11152366
28 /m/04yx4 Man 308 0.11139107
29 /m/01g317 Person 69 0.10962985
30 /m/01g317 Person 69 0.10439652
31 /m/083wq Wheel 409 0.090862416
32 /m/06msq Sculpture 359 0.08330029
33 /m/01g317 Person 69 0.08234371
34 /m/05y5lj Sports equipment 337 0.078681745
35 /m/09j2d Clothing 433 0.0768458
36 /m/04yx4 Man 308 0.075884864
37 /m/04yx4 Man 308 0.06740342
38 /m/01g317 Person 69 0.06324577
39 /m/04yx4 Man 308 0.06278986
40 /m/01g317 Person 69 0.06277132
41 /m/04yx4 Man 308 0.060511187
42 /m/04yx4 Man 308 0.055817537
43 /m/083wq Wheel 409 0.05531507
44 /m/09j2d Clothing 433 0.050744954
45 /m/04yx4 Man 308 0.05006243
46 /m/09j2d Clothing 433 0.049922056
47 /m/09j2d Clothing 433 0.049681067
48 /m/04yx4 Man 308 0.04912561
49 /m/0b_rs Swimming pool 445 0.048854742
50 /m/05y5lj Sports equipment 337 0.04200941
51 /m/01g317 Person 69 0.041352615
52 /m/04yx4 Man 308 0.04089966
53 /m/09j2d Clothing 433 0.040262185
54 /m/04yx4 Man 308 0.0390447
55 /m/0h8mhzd Sports uniform 540 0.038814023
56 /m/01g317 Person 69 0.038691193
57 /m/04yx4 Man 308 0.03564315
58 /m/04yx4 Man 308 0.03502448
59 /m/01g317 Person 69 0.03491944
60 /m/09j2d Clothing 433 0.03437933
61 /m/01g317 Person 69 0.03309837
62 /m/01g317 Person 69 0.032974593
63 /m/09j2d Clothing 433 0.032671154
64 /m/04rky Mammal 298 0.032538544
65 /m/01g317 Person 69 0.031221595
66 /m/01g317 Person 69 0.03066326
67 /m/04yx4 Man 308 0.030130534
68 /m/04rky Mammal 298 0.030032743
69 /m/09j2d Clothing 433 0.029718297
70 /m/09j2d Clothing 433 0.0291651
71 /m/09j2d Clothing 433 0.028960558
72 /m/09j2d Clothing 433 0.028387893
73 /m/04yx4 Man 308 0.027450493
74 /m/01g317 Person 69 0.027107958
75 /m/04yx4 Man 308 0.027106939
76 /m/01g317 Person 69 0.025961738
77 /m/01g317 Person 69 0.025673656
78 /m/09j2d Clothing 433 0.025575927
79 /m/01g317 Person 69 0.02499498
80 /m/04yx4 Man 308 0.024569038
81 /m/09j2d Clothing 433 0.024464408
82 /m/04rky Mammal 298 0.024349347
83 /m/01g317 Person 69 0.024307335
84 /m/01g317 Person 69 0.023867775
85 /m/04rky Mammal 298 0.023107737
86 /m/04yx4 Man 308 0.02282769
87 /m/04rky Mammal 298 0.022633953
88 /m/0138tl Toy 11 0.022467108
89 /m/01g317 Person 69 0.022245709
90 /m/04yx4 Man 308 0.021241672
91 /m/01g317 Person 69 0.021194538
92 /m/09j2d Clothing 433 0.019970622
93 /m/04rky Mammal 298 0.019421574
94 /m/04rky Mammal 298 0.019058326
95 /m/01rzcn Watercraft 106 0.018701846
96 /m/04rky Mammal 298 0.017770693
97 /m/09j2d Clothing 433 0.017455762
98 /m/01g317 Person 69 0.017210666
99 /m/04yx4 Man 308 0.017077602
df2.groupby('detection_class_entities', as_index=False)['detection_scores'].mean()

result:

/usr/local/lib/python3.7/dist-packages/IPython/core/interactiveshell.py:3326: FutureWarning: Dropping invalid columns in DataFrameGroupBy.mean is deprecated. In a future version, a TypeError will be raised. Before calling .mean, select only columns which should be valid for the function.
exec(code_obj, self.user_global_ns, self.user_ns)

index detection_class_entities
0 Clothing
1 Mammal
2 Man
3 Person
4 Sculpture
5 Sports equipment
6 Sports uniform
7 Swimming pool
8 Toy
9 Watercraft
10 Wheel

How can fix?
Thank

83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?