Python Forum

Full Version: group by create pivot table python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello I searched how can i do this but i did not find anything. please Can you help me . I have data set with three columns. i would to create pivot table in python as in below . clusters are created from column B. table below is created in excel. Thank you so much

A B C
0 0,22 0
0 0,87 1
0 0,63 1
1 0,14 0
0 0,97 1
1 0,38 0
0 0,25 1
1 0,25 0
0 0,54 1
1 0,12 1
1 0,85 1
1 0,95 0
1 0,1 1
0 0,9 1
1 0,5 1
0 0,65 1
1 0,78 0
0 0,96 0
1 0,41 0
1 0,52 1
1 0,23 0
0 0,33 1
1 0,41 1
1 0,56 1
1 0,24 1
1 0,98 0



column B AVERAGE C sum from colum C AVERAGE A
(1) 0-0,1 100,00% 6,25% 100,00%
(2) 0-0,2 50,00% 6,25% 100,00%
(3) 0-0,3 40,00% 12,50% 60,00%
(4) 0-0,4 50,00% 12,50% 75,00%
(5) 0-0,5 100,00% 6,25% 100,00%
(6) 1-0,6 100,00% 18,75% 66,67%
(7) 1-0,7 100,00% 12,50% 0,00%
(8) 1-0,8 0,00% 0,00% 100,00%
(9) 1-0,9 100,00% 18,75% 33,33%
(10) 1-0,95 0,00% 0,00% 100,00%
(11) 1-0,96 0,00% 0,00% 0,00%
(12) 1-0,97 100,00% 6,25% 0,00%
(13) 1-0,98 0,00% 0,00% 100,00%
Total 61,54% 100,00% 61,54%
What have you tried so far?
Please see: No effort questions