Spaces:
Sleeping
Sleeping
| 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() | |