File size: 1,282 Bytes
62df27e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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)