Skip to content

Instantly share code, notes, and snippets.

@ChicagoDev
Created April 12, 2019 01:21
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 ChicagoDev/08e135ba1337e933c540330d55117b6f to your computer and use it in GitHub Desktop.
Save ChicagoDev/08e135ba1337e933c540330d55117b6f to your computer and use it in GitHub Desktop.
def getMvp(self, N):
"""
Our Minimum Viable Product. Creates a bar graph with the top
N highest trafficked MTA stations.
:param N: Number of top stations (e.g. Top 10, Top 5) to use in the graph
:type N: int
:return: Seaborn figure to be shown with plt.show()
"""
top_N = self.n_largest(N)
top_N = top_N.div(1000000)
top_ten_indexed = top_N.reset_index()
mvp_chart = sb.barplot(x=top_ten_indexed['STATION'], y=top_ten_indexed['DAILY_ENTRIES'])
sb.despine()
plt.ylabel("People (in millions)", fontsize=10)
plt.xlabel("Station", fontsize=10, labelpad=10)
plt.title("Top "+str(N)+" MTA Stations Ridership Volume")
plt.xticks(fontsize = 8, rotation=80)
return mvp_chart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment