我有一个需要EDA时间序列数据的项目,而在jupyter中它可以正常工作(并且在jupyter中加载数据也需要更少的时间)
在这些之后,我想做的是绘制出单个SKU(项目ID)的数据,我试图用JS编写GUI,并使用图来可视化数据,这是函数:
@eel.expose
def boxPlot():
N = 12 # Number of boxes
c = ['hsl('+str(h)+',50%'+',50%)' for h in np.linspace(0, 360, N)]
months = data_sku['month'].values
print(data_sku)
month_name = ['January','February','March','April','May','June','July','August','September','October','November','December']
fig = go.Figure(data=[go.Box(
name = month_name[i],
y=np.expm1(np.around(data_sku[data_sku.month==int(months[i])]['Total Revenue'].values,decimals=2)),
marker_color=c[i]
) for i in range(int(N))])
fig.update_layout(
title='Total Revenue Distribution for SKU:'+str(list(sku_to_int.keys())[list(sku_to_int.values()).index(sku_num)]),
xaxis=dict(showgrid=True, zeroline=True, showticklabels=True),
yaxis=dict(zeroline=True, gridcolor='white'),
)
fig.show()
aPlot = plotly.offline.plot(fig,output_type='div',include_plotlyjs=False)
return aPlot
传递给np.expm1的值是一个float64 numpy数组
此功能打印出该给定项目或SKU的按月分配的总收入的箱形图。但是每次我尝试在VSCode上或仅通过命令行运行它时,都会出现此错误:
... \ app \ main.py:28:RuntimeWarning:
expm1中遇到溢出