Hiroshi99 commited on
Commit
cf967b6
·
verified ·
1 Parent(s): e68c490

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +44 -0
app.py ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import numpy as np
3
+ import pandas as pd
4
+ import time
5
+ import plotly.express as px
6
+
7
+ df = pd.read_csv('bank.csv')
8
+
9
+ st.set_page_config(
10
+ page_title= 'Real Time Data Science Dashboard',
11
+ page_icon = '✅',
12
+ layout = 'wide'
13
+ )
14
+ #Dashboard
15
+ st.title('Real Time/ Live Data Science Dashboard')
16
+
17
+ #Selection sur le
18
+ job_filter = st.selectbox('Select the job',pd.unique(df['job']))
19
+
20
+ #Filtrage du job
21
+ df = df[df["job"] == job_filter]
22
+
23
+ #Creer des KPI
24
+ avg_age = np.mean(df.age)
25
+ count_married = int(df[(df.marital == 'married')]['marital'].count())
26
+ balance = np.mean(df.balance)
27
+
28
+ kp1,kp2,kp3 = st.columns(3)
29
+ kp1.metric(label='Age ⏳ ',value=round(avg_age), delta = round(avg_age)-10)
30
+ kp2.metric(label = "Married Count 💍", value = int(count_married),delta = -10+count_married)
31
+ kp3.metric(label = "A/C Balanc $", value = f"$ {round(balance,2)}",delta = -round(balance/count_married)*100)
32
+
33
+ fig_col1,fig_col2 = st.columns(2)
34
+ with fig_col1:
35
+ st.markdown("### First Chart")
36
+ fig1 = px.density_heatmap(data_frame=df, y ='age', x= 'marital')
37
+ st.write(fig1)
38
+ with fig_col2:
39
+ st.markdown("### Second Chart")
40
+ fig2 = px.histogram(data_frame=df, x= 'age')
41
+ st.write(fig2)
42
+ st.markdown("###Detailed Data view")
43
+ st.dataframe(df)
44
+ #time.sleep(1)