Reputation: 503
i have use pandas python to analze my data, and i have result from pivot pandas like :
namevendors A B C
unique_id
46 4 0 0
58 2 0 0
362 1 0 0
545 2 0 0
638 2 0 0
745 2 0 0
1014 2 0 0
1114 4 0 0
1254 1 0 0
1354 1 0 0
2089 4 0 0
2472 4 1 0
2949 2 0 0
3049 1 0 1
and i need to get average value from each name vendors, i want result like :
name vendors A B C
[2.2857142857142856 0.07142857142857142 0.07142857142857142]
how can i do that ? name vendors can be more than three
thx
Upvotes: 0
Views: 45
Reputation: 18933
df.mean().to_frame().T
Produces:
namevendors A B C
0 2.285714 0.071429 0.071429
Upvotes: 1