Muhammad Fariz Firdaus
Upload 9 files
39a6292
# Import libraries
import streamlit as st
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
def run():
# Load the dataset
df = pd.read_csv("bquxjob_24b82863_18c2d385ce5.csv")
# Create a sidebar
st.sidebar.title("EDA Options")
st.sidebar.subheader("Choose the features (Only choose 1)")
# Create checkboxes for the features
# Create radio buttons for the features
selected_feature = st.sidebar.radio("Select Feature", ["limit_balance", "sex", "education_level", "marital_status", "age",
"pay_1", "bill_amt_1", "pay_amt_1", "default_payment_next_month"])
# add sub-header
st.sidebar.subheader("Choose the metrics for visualization (can choose multiple)")
# Create a checkbox for the statistics
stats = 0
stats = st.sidebar.checkbox("Statistics")
# Create a checkbox for the distribution
dist = 0
dist = st.sidebar.checkbox("Distribution")
# Create a main title
st.title("Exploratory Data Analysis on Default of Credit Card Clients Dataset")
# Display the default text if no features are selected
if stats == 0 and dist == 0:
st.write("## Welcome to the EDA.")
st.write("Please select the features and metrics that you want to explore from the sidebar.")
else:
# Display the statistics
if stats:
st.subheader("Statistics")
st.write(df[selected_feature].describe())
# Display the distribution
if dist:
st.subheader("Distribution")
fig, ax = plt.subplots(figsize=(10, 6))
sns.histplot(df[selected_feature], kde=True, bins=20)
st.pyplot(fig)
if __name__ == '__main__':
run()