dashboard / app.py
abdouramandalil's picture
Create app.py
62df27e verified
import streamlit as st
import numpy as np
import pandas as pd
import time
import plotly.express as px
df = pd.read_csv('bank.csv')
st.set_page_config(
page_title = 'Real Time Data Science Dashboard',
page_icon = 'βœ…',
layout = 'wide'
)
#Dashboard Title
st.title('Real Time/ Live Data Sceince Dashboard')
#Selection sur le type de job
job_filter = st.selectbox('Select The Job',pd.unique(df['job']))
#Filtrage du job
df = df[df["job"] == job_filter]
#Creer des KPI
avg_age = np.mean(df.age)
count_married = int(df[(df.marital == 'married')]['marital'].count())
balance = np.mean(df.balance)
kp1,kp2,kp3 = st.columns(3)
kp1.metric(label='Age ⏳',value = round(avg_age),delta = round(avg_age)-10)
kp2.metric(label="Married Count πŸ’",value = int(count_married),delta=-10+count_married)
kp3.metric(label="A/C Balanc $",value = f"$ {round(balance,2)}"
,delta = -round(balance/count_married)*100)
fig_col1,fig_col2 = st.columns(2)
with fig_col1:
st.markdown("### First Chart")
fig1 = px.density_heatmap(data_frame=df,y='age',x='marital')
st.write(fig1)
with fig_col2:
st.markdown("### Second Chart")
fig2 = px.histogram(data_frame = df,x='age')
st.write(fig2)
st.markdown("### Detailed Data view")
st.dataframe(df)
#time.sleep(1)