Data_Analysis / app.py
abdouramandalil's picture
Create app.py
3f2ccfc verified
import streamlit as st
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
st.sidebar.image('nvidia.jpeg',width=200)
st.set_option('deprecation.showPyplotGlobalUse', False)
@st.cache_data
def load_data(dataset):
df = pd.read_csv(dataset)
return df
def main():
menu =['Home','Data Analysis','Data Visualisation','About']
choice = st.sidebar.selectbox('Select Menu',menu)
if choice == 'Home':
st.markdown("<h1 style='text-align:center;color: brown;'>Streamlit Diabetis App</h1>",unsafe_allow_html=True)
st.markdown("<h2 style='text-align:center;color: blue;'>Diabetis study in Cameroon</h2>",unsafe_allow_html=True)
left,middle,right = st.columns((1,1.5,1))
st.write("This is an app that will analyse diabetes Datas with some python tools that can optimize decisions")
with middle:
st.subheader('Diabetis Informations')
st.write("In Cameroon, the prevalence of diabetes in adults in urban areas is currently estimated at 6 – 8%, with as much as 80% of people living with diabetes who are currently undiagnosed in the population. Further, according to data from Cameroon in 2002, only about a quarter of people with known diabetes actually had adequate control of their blood glucose levels. The burden of diabetes in Cameroon is not only high but is also rising rapidly. Data in Cameroonian adults based on three cross-sectional surveys over a 10-year period (1994–2004) showed an almost 10-fold increase in diabetes prevalence.")
if choice == 'Data Analysis':
st.markdown("<h2 style='text-align:center;color: green;'>Diabetis Data Analysis</h2>",unsafe_allow_html=True)
st.subheader('Diabetis Dataset')
data = load_data('diabetes.csv')
st.write(data.head())
if st.checkbox('Summary'):
st.write(data.describe())
if st.checkbox('Correlation'):
plt.figure(figsize=(12,12))
st.write(sns.heatmap(data.corr(),annot=True))
st.pyplot()
if choice == 'Data Visualisation':
fig = plt.figure(figsize=(10,4))
data = load_data('diabetes.csv')
sns.histplot(x='Age',data=data)
st.pyplot(fig)
if __name__ == '__main__':
main()