Created
September 28, 2019 18:25
-
-
Save hamletbatista/912efefaf0242e23a0579a2da7c5427a 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
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment