I have employment status and salary as variables. I want to fill NAa of salary with 0 given unemployment=1 otherwise with mean of salary.
df.loc[df['salary'].isnull()] = np.where(df['unemployed']==1, 0, labor['salary']) ValueError: Must have equal len keys and value when setting with an iterable
Is there any way I can do such a conditional fillna? Thanks.
Aucun commentaire:
Enregistrer un commentaire