Skip to content

Instantly share code, notes, and snippets.

@CharlyWargnier
Created February 20, 2020 21:54
Show Gist options
  • Save CharlyWargnier/ecaec851e641ad7427f41eb9451273e0 to your computer and use it in GitHub Desktop.
Save CharlyWargnier/ecaec851e641ad7427f41eb9451273e0 to your computer and use it in GitHub Desktop.
dfLasMonth['FruitClass'] = pd.np.where(dfLasMonth.Title.str.contains("Pear"), "Pear",
pd.np.where(dfLasMonth.Title.str.contains("Apple"), "Apple",
pd.np.where(dfLasMonth.Title.str.contains("Banana"), "Banana",
pd.np.where(dfLasMonth.Title.str.contains("Oranges"), "Oranges", "Else"))))
dfLasMonth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment