File size: 1,201 Bytes
061961e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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

# untuk lebarkan layout setelah import
st.set_page_config(
    page_title = 'Hearth Failure',
    layout = 'wide',
    initial_sidebar_state='expanded'
)

def run():

    # Membuat file
    st.title( 'Death Prediction : Hearth Failure')

    # Membuat sub header
    st.subheader('EDA Hearth Failure')

    # Menambahkan gambar
    image = Image.open('hearth attack.jpg')
    st.image(image, caption='Hearth Failure')

    # Menambahkan deskripsi
    st.write('Page ini merupakan hasil EDA dari dataset Hearth Failure')


    # show data frame
    df = pd.read_csv('https://raw.githubusercontent.com/mukhlishr/rasyidi/main/h8dsft_P1G3_mukhlish_rasyidi.csv')
    st.dataframe(df)

    # Membuat Barplot 
    st.write('###### Plot Death Event')
    fig=plt.figure(figsize=(15,5))
    sns.countplot(x='DEATH_EVENT', data = df)
    st.pyplot(fig)

    # Membuat histogram
    st.write('##### Histogram of Age')
    fig = plt.figure(figsize=(15,5))
    sns.histplot(df['age'], bins=30, kde=True)
    st.pyplot(fig)

    

if __name__ == '__main__':
    run()