Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. data = []
  2. ages = ["Pre-K", "Grade School", "Teens", "Young Adults", "Over 30", "Seniors"]
  3.  
  4. top_5 = []
  5. for i in range(5):
  6. scores = []
  7. for age in ages:
  8. scores.append(tuple(rides.sort_values(age, ascending=False)[[age, "Ride"]].iloc[i].values))
  9. top_5.append(scores)
  10.  
  11. for scores in top_5:
  12. # bar = go.Bar(showlegend=False, text=["{}: {}".format(x[1], x[0]) for x in scores], textposition="auto", x=ages, y=[x[0] for x in scores])
  13. bar = go.Bar(showlegend=False, text=[x[1] for x in scores], textposition="auto", x=ages, y=[x[0] for x in scores])
  14.  
  15. data.append(bar)
  16.  
  17.  
  18. fig = go.Figure(data=data)
  19. # Change the bar mode
  20. fig.update_layout(barmode='group', width=1400)
  21. fig.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement