Hi I have data like this:
for example
id genre total_play
1 pop 20
1 rock 30
1 jazz 60
2 pop 60
2 country 30
2 rock 25
3 latin 25
3 kpop 25
3 folk 10
I want to create a new column based on the following rules:
- If a user listens to jazz music for more than 30% of the total play it will be labeled with category A
- If a user listens to pop music for more than 40% of the total play it will be labeled with category B
- Other than that then C
and will be like this:
id tendency
1 A
2 B
3 C
Thanks before :)