I wrote the following code to generate a couple of charts using the plotly
library:
#Read the excel file from local spreadsheet
df = pd.read_excel(r'C:\Users\llopez\Documents\Temp\Python finished goods.xlsx', sheet_name='Sheet1')
#Create a dictionary of tuples by year
dict_of_fgs = dict(tuple(df.groupby('Year')))
#Loop through the elements of the dictionary of finished goods and plots them grouping FG, type and calculating the sum of quantities. Stacking by type
for k in dict_of_fgs:
df_grouped = dict_of_fgs[k].groupby(['Finished_Good','Type'],sort=False)['Qty'].sum().unstack('Type').iplot(kind='bar',barmode='stack', title='FG Chart')
It yields the following charts:
The charts are exactly what I need, so now I'm looking for a way to generate a web-based report and share it with users.
I looked into the following tutorial but I can't seem to adapt my code to this since my code loops through a dictionary and generates a plot for each key(Year).
How can I generate a web-based report given the charts I've created?
Thanks in advance to all of you subject matter experts for all the great ideas on how to achieve this. I appreciate the help.