Spaces:
Sleeping
Sleeping
File size: 1,240 Bytes
32f1cd2 |
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 time
import plotly.express as px
import pandas as pd
import numpy as np
import streamlit as st
df = pd.read_csv('bank.csv')
st.set_page_config(page_title="Bank Data", page_icon="", layout="wide")
st.title("Bank Data Analysis")
job_filter = st.selectbox('Select Job', pd.unique(df['job']))
df_filtered = df[df['job'] == job_filter]
avg_age = np.mean(df_filtered['age'])
count_married = int(df_filtered['marital'].value_counts()['married'])
kp1, kp2, kp3 = st.columns(3)
kp1.metric(label="Average Age", value=round(avg_age), delta=round(avg_age) - 10)
kp2.metric(label="Married Count", value=count_married, delta=None)
st.subheader("Age vs Marital Status")
fig = px.density_heatmap(df_filtered, x="age", y="marital", nbinsx=20, nbinsy=5, color_continuous_scale="Blues")
st.plotly_chart(fig, use_container_width=True)
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('### first chart')
fig1 = px.histogram(data_frame = df,x='age')
st.write(fig2)
st.dataframe(df)
st.markdown('### charts')
def main():
st.header("welcome")
if __name__ == "__main__":
main()
|