I have a dataframe like the following:
data:
items status
0 jet fail
1 car fail
2 car pass
3 bike fail
4 car fail
5 jet fail
6 bike pass
7 jet fail
8 jet fail
9 bike pass
I want to group the data by items and create a new dataframe with the counts of each value.
Expected output:
df:
unique count pass fail
0 jet 4 0 4
1 car 3 1 2
2 bike 3 2 1
Now one method would be to get a list of unique items and loop on it to find the count, pass and fail and then combine these lists to a dataframe
But how can I do that efficiently ?