Skip to content

Instantly share code, notes, and snippets.

@talfco
Created February 4, 2019 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save talfco/423683f45b35f33da088807155000b33 to your computer and use it in GitHub Desktop.
Save talfco/423683f45b35f33da088807155000b33 to your computer and use it in GitHub Desktop.
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