Skip to content

Instantly share code, notes, and snippets.

@alexpetralia
Created September 25, 2016 02:49
Show Gist options
  • Save alexpetralia/ca013236629008dce1b5863aa7ccda8b to your computer and use it in GitHub Desktop.
Save alexpetralia/ca013236629008dce1b5863aa7ccda8b to your computer and use it in GitHub Desktop.
facet_labels = ['economist_name', 'institution', 'sex']
facets = df.groupby(facet_labels).first().reset_index()[facet_labels]
# Summary statistics
len(df.groupby('topic_name')) # 132 topics
len(df.groupby(['topic_name', 'survey_question'])) # 195 survey questions
len(facets['economist_name'].unique()) # 51 economists
facets.groupby('sex').size() # 11 female, 40 male
facets.groupby('institution').size().sort_values(ascending=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment