Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data = []
- ages = ["Pre-K", "Grade School", "Teens", "Young Adults", "Over 30", "Seniors"]
- top_5 = []
- for i in range(5):
- scores = []
- for age in ages:
- scores.append(tuple(rides.sort_values(age, ascending=False)[[age, "Ride"]].iloc[i].values))
- top_5.append(scores)
- for scores in top_5:
- # 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])
- bar = go.Bar(showlegend=False, text=[x[1] for x in scores], textposition="auto", x=ages, y=[x[0] for x in scores])
- data.append(bar)
- fig = go.Figure(data=data)
- # Change the bar mode
- fig.update_layout(barmode='group', width=1400)
- fig.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement