mardi 23 juin 2020

Pandas apply if statemen

I'm trying to change some column value using apply and an if statement. The condition is very simple and according other answers I've checked it should work but keeps returning an Invalid Syntax error.

df_personal_info['gender'].apply(lambda x: 'Female' if x == 'Fem' else pass)

I'm pretty new to this and I am sure it's a silly mistake that I can't see...

Any help will be appreciate!!

Aucun commentaire:

Enregistrer un commentaire