I have collated files of user testing data into a DataFrame in which columns 0 - 2 are their characteristics and the columns from 3 onwards have item codes for the product brand type/model they have tested. I would like to tally the unique item codes tested grouped by the level, age group, and gender to create summaries and keep track of how many times certain models have been tested. The output needs to have the item code name listed as well with how many times it has been tested for that particular user characteristics, i.e. for an elite, 20-40, F: T3 has been tested 12 times.
I have tried using groupby() methods but cannot get the actual item code name listed with its occurrence count number as well.
The output can be a table form, DataFrame, or suggest another efficient method to tackle this question.
Dataframe format:
age-
index level group gender 0 1 2 ...... 80
1 elite 20-40 F T3 T4 RR23 T34
2 intermediate <11 M T56 T44 RR2 T81
3 elite 11-20 M T45 RR23 T3 RR2
4 beginner >40 F RR2 T56 T3 T45
5 advanced 20-40 F RR22 T4 T45 RR22
6 beginner 11-20 M T81 T4 T56 T4