jeudi 24 septembre 2020

If else function with NaN values

I imported an excel and now I need multiply certain values from the list but if the value from the first column is NaN, Python should take another column for the calculation. I got the following Code:

if pd['Column1'] == 'NaN': pd['Column2'] * pd['Column3'] else: pd['Column1'] * pd['Column3']

Thank you for your help.

Aucun commentaire:

Enregistrer un commentaire