I have the following DataFrame df
:
center status devices
1 Green [d1, d2]
1 Green [d5, d1, d2]
2 Green []
3 Green [d5, d6]
I need to unfold lists in the column devices
. The goal is to group data by center
and device
, and then count the number of observations per group.
The expected result would be the following one:
center device count
1 d1 2
1 d2 2
1 d5 1
3 d5 1
3 d6 1