|
|
|
import streamlit as st |
|
|
|
import pandas as pd |
|
|
|
import seaborn as sns |
|
import matplotlib.pyplot as plt |
|
import plotly.express as px |
|
from PIL import Image |
|
|
|
st.set_page_config( |
|
page_title = 'Predict Credit Card Default', |
|
layout = 'wide', |
|
initial_sidebar_state='expanded' |
|
) |
|
|
|
def run(): |
|
|
|
st.title('Predict Credit Card') |
|
|
|
st.subheader('EDA untuk analisis dataset default credit card') |
|
|
|
st.image('https://image.cermati.com/v1536918930/kcqxfjxwseh5e6kyrrpv.jpg', |
|
caption= 'CREDIT CARD') |
|
|
|
st.write('This page is made by badriahnursakinah') |
|
st.write('# Hello') |
|
|
|
st.markdown('---') |
|
|
|
''' |
|
Pada page kali ini, penulis akan melakukan |
|
eksplorasi sederhana untuk memprediksi kemungkinan default pada pembayaran kartu kredit |
|
Dataset yg digunakan adalah dataset predict default payment next month |
|
Dataset ini berasal dari website Big Query |
|
''' |
|
|
|
data = pd.read_csv('P1G5_Set_1_badriah_nursakinah.csv') |
|
st.dataframe(data) |
|
|
|
st.write('#### Plot education_level') |
|
fig = plt.figure(figsize=(15,5)) |
|
sns.countplot(x='education_level', data= data) |
|
st.pyplot(fig) |
|
|
|
st.write('### Histogram') |
|
options = st.selectbox('Pilih kolom:', |
|
('sex', |
|
'education_level', 'marital_status', |
|
'age')) |
|
fig = plt.figure(figsize=(15,5)) |
|
sns.histplot(data[options], bins=30,kde=True) |
|
st.pyplot(fig) |
|
|
|
st.write('#### Plotly Plot - limit_balance dengan Overall') |
|
fig = px.scatter(data,x='limit_balance',y='default_payment_next_month', hover_data=['pay_0','pay_2','pay_3','pay_4','pay_5','pay_6',]) |
|
st.plotly_chart(fig) |
|
|
|
if __name__ == '__main__': |
|
run() |
|
|