danielle2003 commited on
Commit
ae51f3b
·
1 Parent(s): 127938c

commit name

Browse files
Files changed (2) hide show
  1. dash.py +45 -0
  2. requirements.txt +3 -0
dash.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import time
2
+ import plotly.express as px
3
+ import pandas as pd
4
+ import numpy as np
5
+ import streamlit as st
6
+
7
+ df = pd.read_csv('bank.csv')
8
+
9
+
10
+ st.set_page_config(page_title="Bank Data", page_icon="", layout="wide")
11
+
12
+ st.title("Bank Data Analysis")
13
+
14
+ job_filter = st.selectbox('Select Job', pd.unique(df['job']))
15
+
16
+ df_filtered = df[df['job'] == job_filter]
17
+
18
+ avg_age = np.mean(df_filtered['age'])
19
+ count_married = int(df_filtered['marital'].value_counts()['married'])
20
+
21
+ kp1, kp2, kp3 = st.columns(3)
22
+
23
+ kp1.metric(label="Average Age", value=round(avg_age), delta=round(avg_age) - 10)
24
+ kp2.metric(label="Married Count", value=count_married, delta=None)
25
+
26
+ st.subheader("Age vs Marital Status")
27
+ fig = px.density_heatmap(df_filtered, x="age", y="marital", nbinsx=20, nbinsy=5, color_continuous_scale="Blues")
28
+ st.plotly_chart(fig, use_container_width=True)
29
+ fig_col1,fig_col2 = st.columns(2)
30
+ with fig_col1:
31
+ st.markdown('### first chart')
32
+ fig1 = px.density_heatmap(data_frame = df,y='age',x='marital')
33
+ st.write(fig1)
34
+ with fig_col2:
35
+ st.markdown('### first chart')
36
+ fig1 = px.histogram(data_frame = df,x='age')
37
+ st.write(fig2)
38
+ st.dataframe(df)
39
+ st.markdown('### charts')
40
+
41
+ def main():
42
+ st.header("welcome")
43
+
44
+ if __name__ == "__main__":
45
+ main()
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ pandas
2
+ streamlit
3
+ scikit-learn==1.0.2