Fifa_prediction / eda.py
hammammahdy's picture
first commit
206bf0d
raw
history blame
1.63 kB
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
def run():
# membaut title
st.title('Fifta 2022 Player Rating Prediction')
# Membuat subheader
st.subheader('EDA untuk analisa dataset FIFA 2022')
# Tambahkan gambar
image = Image.open('bola.jpg')
st.image(image, caption = 'FIFA 2022')
# Menambahkan deskripsi
st.write('Page ini dibuat oleh Hammam')
# Membuat markdown
st.markdown('---------')
# Show dataframe
df=pd.read_csv('https://raw.githubusercontent.com/FTDS-learning-materials/phase-1/master/w1/P1W1D1PM%20-%20Machine%20Learning%20Problem%20Framing.csv')
st.dataframe(df)
# Membuat bar plot
st.write('#### Plot AttackingWorkRate')
fig = plt.figure(figsize=(15,5))
sns.countplot(x='AttackingWorkRate', data=df)
st.pyplot(fig)
# Membuat histogram
st.write('#### Histogram of Rating')
fig = plt.figure(figsize=(15,5))
sns.histplot(df['Overall'], bins = 30, kde = True)
st.pyplot(fig)
# Membuat histogram berdasarkan inputan user
st.write('#### histogram berdasarkan input user')
option = st.selectbox('pilih column :', ('Age', 'Weight', 'Height', 'ShootingTotal'))
fig = plt.figure(figsize=(15,5))
sns.histplot(df[option], bins=30, kde=True)
st.pyplot(fig)
# Membuat plotly plot
st.write('#### plotly plot - ValueEUR vs Overall')
fig = px.scatter(df, x = 'ValueEUR', y = 'Overall', hover_data=['Name', 'Age'])
st.plotly_chart(fig)
if __name__ == '__main__':
run()