Summary
I am trying to code code a simple algorithm which can identify the type of the distribution of the given data set. To accomplish that, I used scipy.stats.goodness_of_fit. It works without using/launching streamlit in my script. However, when it comes to using with streamlit in the same code, it generates the following error. I shared my code below. And note that, all the versions of the libraries that I have been using are updated already along with python.
Steps to reproduce
Code snippet:
class Statistics:
@staticmethod
def execute(data):
data.fillna(value=0, method=None, inplace=True)
por = data["Porosity"]
rng = np.random.default_rng()
pseudo_data = stats.uniform.rvs(size=len(por), random_state=rng)
known_params = {
'loc': por.mean(),
'scale': por.std()
}
res = stats.goodness_of_fit(stats.norm, pseudo_data, known_params=known_params,
statistic='ks', random_state=rng)
return res.pvalue
file = st.file_uploader(label="Upload Your Data File", accept_multiple_files=False, type=["csv", "xlsx", "json"])
file_name = file.__str__()
if ".csv" in file_name:
pass
elif ".xlsx" in file_name:
file_dataFrame = pd.read_excel(file, sheet_name="Sheet1")
phi = Statistics()
st.write(phi.execute(file_dataFrame))