Created
February 4, 2019 22:02
Star
You must be signed in to star a gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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