abdouramandalil commited on
Commit
62df27e
·
verified ·
1 Parent(s): 1e7a15d

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +45 -0
app.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 Title
15
+ st.title('Real Time/ Live Data Sceince Dashboard')
16
+ #Selection sur le type de job
17
+ job_filter = st.selectbox('Select The Job',pd.unique(df['job']))
18
+
19
+ #Filtrage du job
20
+ df = df[df["job"] == job_filter]
21
+
22
+ #Creer des KPI
23
+ avg_age = np.mean(df.age)
24
+ count_married = int(df[(df.marital == 'married')]['marital'].count())
25
+ balance = np.mean(df.balance)
26
+
27
+ kp1,kp2,kp3 = st.columns(3)
28
+ kp1.metric(label='Age ⏳',value = round(avg_age),delta = round(avg_age)-10)
29
+ kp2.metric(label="Married Count 💍",value = int(count_married),delta=-10+count_married)
30
+ kp3.metric(label="A/C Balanc $",value = f"$ {round(balance,2)}"
31
+ ,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)
45
+