change the value of dataframe linkaiyi Erstellt: 5. Januar 2021 11:43 - Aktualisiert: 5. Januar 2021 11:43 - Lesezeit: 1 mins Follow Change Value of a Dataframe Column Based on a Filter df['purchase'] = 0 df.loc[df['dollars_spent'] > 0, 'purchase'] = 1 df['purchase'] = df['dollars_spent'].apply(lambda x: 1 if x > 0 else 0) Object has 0 attachments Was this article helpful? 0 0 This article is viewed 19 times! Recent Viewed Articles change the value of dataframe Github resources Nginx Setting Deactivate Brower to force https subprocess run parameters Related Articles Pandas using iterrows() and itertuples() in pandas Pandas and list usage in Python Pandas manipulate columns pandas groupby 0 Comments Leave a Comment cancel reply