How to create a new dataframe column with a set of nested IF rules (apply is very slow)

What I need I need to create new columns in pandas dataframes, based on a set of nested if statements. E.g. if city == 'London' and income > 10000: return 'group 1' elif city == 'Manchester' or city == 'Leeds': return 'group 2' elif borrower_age > 50: return 'group 3' else: return 'group 4' This … Read more

Subtracting objects

I am a beginner and I was trying to subtract the attack of the health from the dark knight from the attack of a player but when I do a print of the health after the operation it stays the same.