基于以下链接:Streamlit displot
我已经在回归数据集上尝试了我自己的示例:
import streamlit as st
import pandas as pd
import plotly.figure_factory as ff
data =pd.read_csv("https://raw.githubusercontent.com/krishnaik06/Multiple-Linear-Regression/master/50_Startups.csv")
print(data.head())
print(data.shape)
hist_data =[data['R&D Spend'].values,data['Administration'].values,data['Marketing Spend'].values,data['Profit'].values]
groups =["R&D spend","Administration","Marketing Spend","Profit"]
fig =ff.create_distplot(hist_data=hist_data,group_labels=groups,bin_size=[0.1,0.25,0.5,0.75])
st.plotly_chart(fig,use_container_width=True)
shape 返回 (50,5),因此它是非常小的数据集,但是当我运行代码时,它需要太长时间并返回以下错误:
你能告诉我如何解决它吗?
根据Plotly 的
create_distplot
文档,使用您当前的功能,我确实仍然遇到类似的问题,导致我的浏览器告诉我“此页面正在减慢Firefox”。增大垃圾箱的尺寸可以缓解这个问题:
它给: