r/learnpython • • 21h ago

Turn these two variables into 1

I'm trying to turn these two variables, this is for homework so I'm gonna call it something else. I want to turn people1 and people2 into 1 variable.

people1 has two values, "not green" and "green". people2 has two values as well, "not purple" and "purple".

I want to make it so that everyone with "not green" and "not purple" are combined into one label, but only if they have both, not just one. I am struggling so bad :(

I am using pandas in python also. Thank you.

Edit: I want something like this: https://www.reddit.com/u/blackgarliccookie/s/xkzPCrmyrB

6 Upvotes

15 comments sorted by