Generation

generate functionFri, 27 Jan 2023

There is a code for Pandas df4['loyal_profit'] = df4.apply(lambda x: (x.profit / x.ocup_rooms) if 'regular_customer' in x.how_find_us else None, axis=1) This code gives out an error. Rewrite it so that it searches not only for 'regular_customer' values but also for 'by_recommendation' values

df4['loyal_profit'] = df4.apply(lambda x: (x.profit / x.ocup_rooms), axis=1)

Questions about programming?Chat with your personal AI assistant