我编写了以下代码来使用plotly库生成几个图表:#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')
得出以下图表:
这些图表正是我需要的,所以现在我正在寻找一种方法来生成一个基于web的报告并与用户共享。在
我查看了下面的教程,但是我似乎不能使我的代码适应这一点,因为我的代码在字典中循环并为每个键(年)生成一个图。在
根据我创建的图表,如何生成基于web的报告?在
提前感谢你们所有的主题专家,为实现这一目标提供了所有的好主意。我很感激你的帮助。在