uno / eda.py
wismaeka's picture
Update eda.py
ba3f15b verified
raw
history blame
1.12 kB
import streamlit as st
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import plotly.express as px
def run():
#membuat judul
st.title('Fraud Transaction Prediction')
#membuat subheader
st.subheader('EDA Page')
#buat garis
st.markdown('---')
#show dataframe
df = pd.read_csv('Fraud_data_filtered.csv')
st.dataframe(df)
#membuat histogram
st.write('#### Histogram Plot')
option = st.selectbox('Choose column: ', (
'amount', 'old_balance_ori', 'new_balance_ori', 'old_balance_dest', 'new_balance_dest', 'type', 'isFraud'))
fig = plt.figure(figsize=(15, 5))
sns.histplot(df[option], bins=30, kde=True)
st.pyplot(fig)
#membuat plotly plot
st.write('#### Plotly Plot - type and isFraud')
fig = px.histogram(df, x='type', color='isFraud', title='Type and isFraud')
st.plotly_chart(fig)
#membuat plotly plot
st.write('#### Plotly Plot - amount and isFraud')
fig = px.scatter(df, x='amount', y='isFraud', hover_data=['amount', 'isFraud'])
st.plotly_chart(fig)
if __name__ == '__main__':
run()