import streamlit as st import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import plotly.express as px st.set_page_config( page_title = 'DEFAULT PAYMENT NEXT MONTH - EDA', layout='wide', initial_sidebar_state='expanded' ) def run(): #membuat title st.title('DEFAULT PAYMENT NEXT MONTH PREDICTION') #membuat subheader st.subheader('EDA untuk analisis dataset DEFAULT PAYMENT NEXT MONTH') #menambahkan gambar st.image('https://navi.com/blog/wp-content/uploads/2022/06/credit-card.jpg') caption= ('CREDIT CARD') #menambahkan deskripsi st.write('# page ini dibuat oleh Salman Hamka De Qais') #membuat garis st.markdown('---') #magicsyntax ''' pada page ini, penuis akan melakukan explorasi sederhana, dataset yang digunakan adalah dataset Credit card. dataset ini berasa dari bigquery.com. ''' #showdatabase df = pd.read_csv('P1G5_Set_1_salman_hamka.csv') st.dataframe(df) #membuat barplot fig = plt.figure(figsize=(6, 3)) sns.countplot(x='education_level', data=df) plt.title('Distribution of Education Level') plt.xlabel('Education Level') plt.ylabel('Count') st.pyplot(fig) #membuat histogram fig = plt.figure(figsize=(6, 3)) sns.histplot(df['age'], bins=30, kde=True) plt.title('Distribution of Age') plt.xlabel('Age') plt.ylabel('Frequency') st.pyplot(fig) #membuat plotly plot fig = plt.figure(figsize=(6, 3)) sns.scatterplot(x='limit_balance', y='bill_amt_1', data=df, hue='default_payment_next_month', palette='coolwarm') plt.title('Limit Balance vs Bill Amount for the First Month') plt.xlabel('Limit Balance') plt.ylabel('Bill Amount (Month 1)') plt.legend(title='Default Payment Next Month') st.pyplot(fig) # Pie Chart untuk Jenis Kelamin sex_counts = df['sex'].value_counts() fig = plt.figure(figsize=(6, 3)) sex_counts.plot.pie(autopct='%1.1f%%', startangle=90, colors=sns.color_palette('pastel')) plt.title('Distribution of Sex') plt.ylabel('') st.pyplot(fig) # Scatter Plot untuk Hubungan antara Batas Kredit dan Jumlah Tagihan Bulan Pertama fig = plt.figure(figsize=(6, 3)) sns.scatterplot(x='limit_balance', y='bill_amt_1', data=df, hue='default_payment_next_month', palette='coolwarm') plt.title('Limit Balance vs Bill Amount for the First Month') plt.xlabel('Limit Balance') plt.ylabel('Bill Amount (Month 1)') plt.legend(title='Default Payment Next Month') st.pyplot(fig) if __name__ == '__main__': run()