Skip to content

Instantly share code, notes, and snippets.

@john-adeojo
Created February 6, 2021 01:50
Show Gist options
  • Select an option

  • Save john-adeojo/b970942866131c1b450d21133774fbee to your computer and use it in GitHub Desktop.

Select an option

Save john-adeojo/b970942866131c1b450d21133774fbee to your computer and use it in GitHub Desktop.
Dataframe that feeds transformer
def mergetopics(docs_per_topic, topic_sizes):
# Bring it all together to get a summary of topics, all text bodies within the topic and top size.
docs_per_topic["Topic_words"] = docs_per_topic.Topic.map(top_n_words)
reddit_topics = pd.merge(docs_per_topic, topic_sizes, how="left", on="Topic")
return reddit_topics
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment