Skip to content

Instantly share code, notes, and snippets.

@guerbai
Created June 2, 2019 05:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guerbai/2a3a018687abbb6c744fb372152577d7 to your computer and use it in GitHub Desktop.
Save guerbai/2a3a018687abbb6c744fb372152577d7 to your computer and use it in GitHub Desktop.
获取description中包含fruity的数量 #Pandas
n_trop = reviews.description.map(lambda desc: "tropical" in desc).sum()
n_fruity = reviews.description.map(lambda desc: "fruity" in desc).sum()
descriptor_counts = pd.Series([n_trop, n_fruity], index=['tropical', 'fruity'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment