Created
July 15, 2019 00:09
-
-
Save kperry2215/e651d935d8d382da519210e6488084c8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def generate_bar_graph(df, title): | |
""" | |
This function creates a bar graph from pandas dataframe columns. | |
Arguments: | |
df: Pandas dataframe. Index will be x-axis. Categories and | |
associated amounts are from columns | |
title: String. Name of the bar graph | |
Outputs: | |
Bar graph in console. | |
""" | |
df.plot.bar(rot=0) | |
plt.title(title, color='black') | |
plt.legend(loc='center left', bbox_to_anchor=(1.0, 0.5)) | |
plt.show() | |
... | |
#Execution in main script | |
generate_bar_graph(vendor_data_stacked_bar_graph_pivoted, | |
title='Number of Times Vendor Was Purchased From Over Quarter') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment