I have a data frame containing the profession and the questions from a questionnaire used in a survey. I'm trying to summarise which questionnaire we used for which profession, but we have similar questions for different professions, even though we do not have the same questionnaires. So I'm trying to figure out similar questions to similar professions. Basically, I have this:
profession question
AAAA question_a
AAAA question_b
BBBB question_a
BBBB question_d
CCCC question_a
CCCC question_c
And I want to get something like this:
question profession
question_a AAAA
BBBB
CCCC
question_d BBBB
question_c CCCC
or perhaps I could get some sort of list or dict in order to use later.
I've tried the command below:
df.groupby(['question','profession']).count()
And gotten the output:
question profession other_column_1 other_column_2
question_a AAAA
BBBB
.
.
.
The problem with it is that I can't actually work with it. I don't know how to access the question and profession field, I don't know how to list the combinations, etc.