r/learnpython • u/blackgarliccookie • 23h 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
View all comments
Show parent comment
1
u/khosrua 22h ago
Can you just mock up before and after in Excel and paste the screenshot?