Skip to content

Instantly share code, notes, and snippets.

@hamletbatista
Created February 27, 2019 22:12
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 hamletbatista/9f077919531debbbd26fbba21140ecca to your computer and use it in GitHub Desktop.
Save hamletbatista/9f077919531debbbd26fbba21140ecca to your computer and use it in GitHub Desktop.
def get_category(path):
words = re.split("[-/]", path)
for word in words:
if word in word_cloud:
return word
return "other"
df['category']=df.path.apply(get_category)
df.head()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment