I have a standard dataframe like the one below :
Id Type Speed Efficiency Durability
0 Id001 A OK OK nonOK
1 Id002 A nonOK OK nonOK
2 Id003 B nonOK nonOK nonOK
3 Id004 B nonOK nonOK OK
4 Id005 A nonOK nonOK OK
5 Id006 A OK OK OK
6 Id007 A OK nonOK OK
7 Id008 B nonOK nonOK OK
8 Id009 C OK OK OK
9 Id010 B OK OK nonOK
10 Id011 C OK nonOK OK
11 Id012 C OK nonOK OK
12 Id013 C nonOK OK OK
13 Id014 C nonOK nonOK OK
14 Id015 C nonOK nonOK OK
And I'm trying to get this kind of output :
Type Test Speed Efficiency Durability
0 A OK 3 3 3
1 A nonOK 2 2 2
2 B OK 1 1 2
3 B nonOK 3 3 2
4 C OK 3 2 6
5 C nonOK 3 4 0
I tried with df.groupby('Type').agg('count') but it doesn't give the expected output.
Is it possible to make this kind of transformation with pandas, please ?