Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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