Spaces:
Sleeping

fifa-2021 / src /eda.py
aristrisnawan's picture
initial commits
2340934 verified
Raw History Blame Contribute Delete
1.76 kB
import streamlit as st
import pandas as pd
import seaborn as sns
import plotly.express as px
from PIL import Image
import matplotlib.pyplot as plt
def run():
st.title('Aplikasi Prediksi Rating Pemain Fifa 2021')
#membuat sub header
st.subheader('Page ini mengenai Exploratory Data Analysis dari dataset FIFA 2021')
# menambahkan gambar
image = Image.open('./src/image.jpg')
st.image(image, caption='EDA FIFA 2021')
#menambahkan text
st.write('Page ini untuk pemantauan *bibit muda* pesepakbola')
st.write('# Page ini untuk pemantauan *bibit muda* pesepakbola')
#menampilkan 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 barplot
st.write('### Plot AttackingWorkRate')
fig = plt.figure(figsize=(15,5))
sns.countplot(x='AttackingWorkRate', data=df)
st.pyplot(fig)
#membuat histogram rating
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 input user
st.write('### Histogram berdasarkan input user')
option = st.selectbox('Pilih Column : ', ('Age','Height','Weight','ShootingTotal'))
fig = plt.figure(figsize=(15,5))
sns.histplot(df[option], bins=30, kde=True)
st.pyplot(fig)
# membuat histogram menggunakan plotly
# st.write('### Plotly plot - ValueEUR vs Overall')
# fig = px.scatter(df, x='ValueEUR', y='Overall', hover_date=['Name','Age'])
# st.plotly_chart(fig)
if __name__ == '__main__':
run()