File size: 2,262 Bytes
45662b6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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():
    # membuat Tittle
    st.title('FIFA 2022 Player Rating Prediction')

    # membuat sub header
    st.subheader('Eda untuk Analisis Dataset FIFA 2022')


    # menambahkan gambar
    st.image('https://cdn.pixabay.com/photo/2016/06/22/08/40/cow-1472655_1280.png', caption='SAPI')

    st.image('gambar1.png')

    # menambahkan deskripsi
    st.write('Page ini dibuat oleh Kumala Chann') #anggap seperti markdown
    st.write('# Halo')
    st.write('## Halo')
    st.write('### Halo')

    # membuat garis lurus 
    st.markdown('---')

    # MAGIC syntax
    '''
    Pada page kali ini penulis akan melakukan eksplorasi sederhana,
    dataset yang digunakan adalah dataset FIFA 2022.
    Dataset ini berasal dari web sofifa.com
    '''

    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)
    st.write('Ini analisisnya')

    # membuat histogram
    st.write('### Histogram Berdasarkan Overall')
    fig = plt.figure(figsize=(15,5))
    sns.histplot(df['Overall'], bins=30, kde=True)
    st.pyplot(fig)

    # membuat histogram berdasrakan input user
    st.write('### Histogram Berdasarkan Input User')
    pilihan = st.selectbox('Pilih kolom: ', ('Age','Weight','Height','ShootingTotal'))
    fig = plt.figure(figsize=(15,5))
    sns.histplot(df[pilihan], bins=30, kde=True)
    st.pyplot(fig)

    if pilihan == 'Height':
        st.write('Kolom height sangat skew')
    elif pilihan == 'Weight':
        st.write('Kolom weight sangat skew')
    elif pilihan == 'Age':
        st.write('Kolom age sangat skew')
    else:
        st.write('Kolom shooting total sangat skew')

    # interactif chart
    st.write('### Plotly Plot - ValueEUR dengan Overall')
    fig = px.scatter(df, x='ValueEUR', y='Overall',hover_data=['Name','Age'])
    st.plotly_chart(fig)


if __name__ == '__main__':
    run()