Skip to content

Instantly share code, notes, and snippets.

@talfco
Created February 4, 2019 22:02
  • 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/115dff294129e094c5862d316cd3d582 to your computer and use it in GitHub Desktop.
def create_politican_table(self):
# Panda Data Frame - Table of all Parliament Members
panda_data = { 'ScreenName' : self.__col_screen_name,
'Name': self.__col_name,
'Description': self.__col_description,
"FollowersCount": self.__col_followers_count,
"FriendsCount": self.__col_friends_count,
"Party": self.__col_party
}
df = DataFrame(panda_data , index=self.__labels)
# Sort by Followers Count
df = df.sort_values(['FollowersCount'], ascending=[0])
# Create a Plotly Table
trace = go.Table(
header = dict(values=list(df.columns)),
cells = dict(values=[df.ScreenName, df.Name, df.Description,
df.FollowersCount, df.FriendsCount, df.Party]))
data = [trace]
py.plot(data, filename=self.__country_code+'-tw-politician-list')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment