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