I have a DataFrame like this one:
customer_type age satisfaction design food wifi service distance
Loyal 28 Not Satisfied 0 1 2 2 13.5
Loyal 55 Satisfied 5 3 5 4 34.2
Disloyal 36 Not Satisfied 2 0 2 4 55.8
Disloyal 28 Not Satisfied 3 1 2 2 13.5
Disloyal 33 Not Satisfied 2 1 2 2 13.5
Disloyal 35 Not Satisfied 2 1 2 2 13.5
Disloyal 39 Not Satisfied 1 1 2 2 13.5
Disloyal 31 Not Satisfied 2 1 2 2 13.5
Loyal 28 Not Satisfied 0 1 2 2 13.5
Disloyal 31 Not Satisfied 2 1 2 2 13.5
Disloyal 40 Not Satisfied 2 1 2 2 13.5
Disloyal 35 Not Satisfied 2 1 2 2 13.5
Disloyal 35 Not Satisfied 2 2 2 2 13.5
I want to find out the characteristics of the Disloyal
and Not Satisfied
customers that are between 30 and 40 years old, grouping them by the service they have rated:
service ratings_count age age_count population_pct
design 8 40 1 7.69
36 1 7.69
35 3 23.07
33 1 7.69
31 2 15.38
food 1 35 1 7.69
I suspect I have to use melt
but I can't figure out how to groupby
from there.