Filtruj i wartość zmiany pandy

df.loc[df['dollars_spent'] > 0, 'purchase'] = 1
Cerbrain