dimanche 27 septembre 2020

Pandas if column X is not a null value, take the value of column X, else take column Y value

df['raw_score']
df['indicator']
df['final_score']

Hi everyone, i have 3 columns in a pandas df. I want the column 'final_score' to be a condition using both 'raw_score' and 'indicator'.

this is the condition i am trying to achieve:
df['final_score'] = if df['indicator'] is not a null value, take the value of df['indicator'], else take df['raw_score'].

I cant figure out how to do this and need your help!

Aucun commentaire:

Enregistrer un commentaire