Created
February 4, 2019 22:12
-
-
Save talfco/423683f45b35f33da088807155000b33 to your computer and use it in GitHub Desktop.
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_plotly_table(self): | |
lists = self.get_government_members() | |
labels = range(0,len(lists)) | |
col1 = [list.screen_name for list in lists] | |
col2 = [list.name for list in lists] | |
col3 = [list.description for list in lists] | |
col4 = [list.followers_count for list in lists] | |
col5 = [list.friends_count for list in lists] | |
# Panda Data Set | |
panda_data = { 'ScreenName' : col1, | |
'Name': col2, | |
'Description': col3, | |
"FollowersCount": col4, | |
"FriendsCount": col5 | |
} | |
df = DataFrame(panda_data , index=labels) | |
trace = plotly.graph_objs.Table( | |
header = dict(values=list(df.columns)), | |
cells = dict(values=[df.ScreenName, df.Name, df.Description, df.FollowersCount, df.FriendsCount])) | |
data = [trace] | |
plotly.plotly.plot(data, filename='pandas_table') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment