import streamlit as st import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import plotly.express as px from PIL import Image st.set_page_config( page_title='FIFA 2022 Prediction', layout='wide', initial_sidebar_state='expanded') def run(): st.title("FIFA 2022 Exploratory Data Analysis") st.subheader("Analysis Data for 2022 Football Player by FIFA") # # Add image # image = Image.open('socerfield.jpg') # st.image(image, caption='FIFA 2022') # Create Outline st.write("# Outline A") st.write("## Outline A.1") st.write("### Outline A.1.a") st.write("# Outline B") # Create markdown line st.markdown("---") # Show datafreame st.write("# Dataframe FIFA 2022") 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) st.markdown("---") # Visualization st.write('# Visualization') # Create Barplot st.write('## Attacking Work Rate Plot') fig = plt.figure(figsize=(15,5)) sns.countplot(x='AttackingWorkRate', data=df) st.pyplot(fig) st.write('Explanation') # Create Histplot st.write('## Histogram of Rating') fig = plt.figure(figsize=(15,5)) sns.histplot(x='Overall', data=df, bins=50, kde=True) # Add line st.pyplot(fig) st.write("Explanation") # Create scatterplot st.write('## Scatterplot of Weight and Height') fig = plt.figure(figsize=(15,5)) sns.scatterplot(x='Weight', y='Height', data=df) st.pyplot(fig) st.write("Explanation") # Create histogram by user input st.write('# Visualization by User Input') choice = st.radio('Select Feature: ', ('Age','Weight','Height','ShootingTotal'), help='Select the feature you want!') fig = plt.figure(figsize=(15,5)) sns.histplot(df[choice], bins=35, kde=True) # Add line st.pyplot(fig) st.write('Explaination') # Create plotly plot st.write('# Plotly Plot - Player Price againts Rating') fig = px.scatter(df, x='ValueEUR', y='Overall', hover_data=['Name','Age']) st.plotly_chart(fig) st.write('Explain!') if __name__ == '__main__': run()