Skip to content

Instantly share code, notes, and snippets.

@talfco
Last active January 27, 2019 10:53
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save talfco/f84cfe40d5c4fa825d53deffd90dff05 to your computer and use it in GitHub Desktop.
Python Tutorial: Checking the Party membership of a twitter account.
# Method will return the party of the list member by analyzing
# twitter account attributes. If party cannot be detected the
# account column have an entry "unknown"
def check_for_party(self, account_list):
party_column = []
party_abbreviations = ["FDP", "CVP", "SP", "SVP", "EVP", "BDP"]
for account in account_list:
party = "unknown"
for abbr in party_abbreviations:
if abbr in account.description:
found = True
party = abbr
party_column.append(party)
return party_column
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment