File size: 1,812 Bytes
a4f1c8f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
78
79
80
81
82
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""


@author: hamzafarooq@ MABA CLASS
"""

import streamlit as st
import pandas as pd

import plotly.express as px





st.title("Uma")
st.markdown("This is a demo Streamlit app.")
st.markdown("My name is UN, hello world!..")
st.markdown("This is v2")

@st.cache(persist=True)
def load_data():
    df = pd.read_csv("https://datahub.io/machine-learning/iris/r/iris.csv")
    return(df)



def run():
    st.subheader("Iris Data Loaded into a Pandas Dataframe.")

    df = load_data()



    disp_head = st.sidebar.radio('Select DataFrame Display Option:',('Head', 'All'),index=0)



    #Multi-Select
    #sel_plot_cols = st.sidebar.multiselect("Select Columns For Scatter Plot",df.columns.to_list()[0:4],df.columns.to_list()[0:2])

    #Select Box
    #x_plot = st.sidebar.selectbox("Select X-axis Column For Scatter Plot",df.columns.to_list()[0:4],index=0)
    #y_plot = st.sidebar.selectbox("Select Y-axis Column For Scatter Plot",df.columns.to_list()[0:4],index=1)


    if disp_head=="Head":
        st.dataframe(df.head())
    else:
        st.dataframe(df)
    #st.table(df)
    #st.write(df)


    #Scatter Plot
    fig = px.scatter(df, x=df["sepallength"], y=df["sepalwidth"], color="class",
                 size='petallength', hover_data=['petalwidth'])

    fig.update_layout({
                'plot_bgcolor': 'rgba(0, 0, 0, 0)'})

    fig.update_xaxes(showgrid=True, gridwidth=1, gridcolor='lightgray')
    fig.update_yaxes(showgrid=True, gridwidth=1, gridcolor='lightgray')

    st.write("\n")
    st.subheader("Scatter Plot")
    st.plotly_chart(fig, use_container_width=True)


    #Add images
    #images = ["<image_url>"]
    #st.image(images, width=600,use_container_width=True, caption=["Iris Flower"])





if __name__ == '__main__':
    run()