catherinehelenna/model_test_111
0
1import streamlit as st2import numpy as py3import pandas as pd4from PIL import Image5import matplotlib.pyplot as plt6import seaborn as sns7 8def run():9 st.write("### FIRST TIME EXISTING IN STREAMLIT")10 st.write("Hello World!")11 12 # pencet control + c untuk exit terminal13 14 # Load gambar15 gambar = Image.open('foto anjingku.JPG')16 st.image(gambar)17 18 # import visualisasi19 data = pd.read_csv('university-tuition-fees.csv')20 # data=pd.read_csv('https://raw.githubusercontent.com/FTDS-learning-materials/phase-1/master/w1/P1W1D3AM%20-%20Feature%20Engineering%20-%20Part%201%20-%20Titanic.csv')21 st.dataframe(data)22 23 # membuat boxplot dari seaborn24 fig = plt.figure(figsize=(15,5))25 sns.boxplot(x = data['tuition_fees'], data = data)26 st.pyplot(fig)27 28 # membuat bar chart29 new_data = data['type'].value_counts()30 st.bar_chart(new_data)31 32 # membuat boxplot dengan pilihan33 opsi = st.selectbox('Pilihan kolom: ',('world_rank','cost_of_living','minimum_ielts_score'))34 figure_plot = plt.figure(figsize=(15,5))35 sns.boxplot(x = opsi, data = data)36 st.pyplot(figure_plot)37 38 39if __name__ == '__main__':40 run()