Skip to content

Instantly share code, notes, and snippets.

@stefsmeets
Created April 5, 2022 09:20
Show Gist options
  • Save stefsmeets/a3bfc639b5c2b5ae40e2477aaa428a10 to your computer and use it in GitHub Desktop.
Save stefsmeets/a3bfc639b5c2b5ae40e2477aaa428a10 to your computer and use it in GitHub Desktop.
import numpy as np
from scipy.stats import norm
import matplotlib.pyplot as plt
import streamlit as st
st.title('Normal distribution')
mu_in = st.slider('Mean', value=5, min_value=-10, max_value=10)
std_in = st.slider('Standard deviation', value=5.0, min_value=0.0, max_value=10.0)
size = st.slider('Number of samples', value=100, max_value=500)
def norm_dist(mu, std, size=100):
"""Generate normal distribution."""
return norm.rvs(mu, std, size=size)
data = norm_dist(mu_in, std_in, size=size)
# Fit the normal distribution
mu, std = norm.fit(data)
# Make some plots
...
st.pyplot(fig)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment