Working off https://app.dataquest.io/m/288/guided-project%3A-investigating-fandango-movie-ratings/7/determining-the-direction-of-the-change, the goal was to get a plot like :
However, when you get to that point, you still don’t know that you need a dataframe that looks like :
What if your
df looks like :
How can you get it to the format that enables overlaid bar plots?
Hoping someone thinks of something more elegant My solution :
final = summary.transpose()[1:] # assumes that the first row in transposed is now 'year' final.columns = summary['year'] # rest is copied from Alex O's notebook.. plt.style.use('fivethirtyeight') final['2015'].plot.bar(color = '#0066FF', align = 'center', label = '2015', width = .25) final['2016'].plot.bar(color = '#CC0000', align = 'edge', label = '2016', width = .25, rot = 0, figsize = (8,5)) plt.title('Comparing summary statistics: 2015 vs 2016', y = 1.07) plt.ylim(0,5.5) plt.yticks(np.arange(0,5.1,.5)) plt.ylabel('Stars') plt.legend(framealpha = 0, loc = 'upper center') plt.show()