Skip to content

Instantly share code, notes, and snippets.

@ecdedios
Last active May 31, 2020 03:48
Show Gist options
  • Save ecdedios/5b07ba4950aa2bddd666b614b31064fa to your computer and use it in GitHub Desktop.
Save ecdedios/5b07ba4950aa2bddd666b614b31064fa to your computer and use it in GitHub Desktop.
Manually constructing a list of tuples.
entity_counts = []
entity_counts.append(('Democrats', df_counts.loc[df_counts.entity.isin(['Democrats', 'Dems', 'Democrat'])]['count'].sum()))
entity_counts.append(('Americans', df_counts.loc[df_counts.entity.isin(['American', 'Americans'])]['count'].sum()))
entity_counts.append(('Congress', df_counts.loc[df_counts.entity.isin(['House', 'Senate', 'Congress'])]['count'].sum()))
entity_counts.append(('America', df_counts.loc[df_counts.entity.isin(['U.S.', 'the United States', 'America'])]['count'].sum()))
entity_counts.append(('Republicans', df_counts.loc[df_counts.entity.isin(['Republican', 'Republicans'])]['count'].sum()))
entity_counts.append(('China', 533))
entity_counts.append(('FBI', 316))
entity_counts.append(('Russia', 313))
entity_counts.append(('Fake News', 248))
entity_counts.append(('Mexico', 213))
entity_counts.append(('Obama', 176))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment