File size: 6,719 Bytes
7a4db40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
import streamlit as st
import streamlit.components.v1 as components
from activities.activity import ml
from ml.mlmodel import MLDataset
import plotly.express as px
import pandas as pd
import pandas_profiling
import os
from sklearn.datasets import load_diabetes
from streamlit_pandas_profiling import st_profile_report
from streamlit_option_menu import option_menu


def main():
    
     #Sidebar
    from PIL import Image
    st.sidebar.image('logo.png', use_column_width=True)
    image_loan=Image.open(os.path.join("data analysis.jpg"))
    rad = st.sidebar.radio("Navigation",["Home","Analysis","Visualize","Machine-Learning"])
    # if rad=="Home":
    #     HtmlFile = open("style.css", 'r', encoding='utf-8')
    #     source_code = HtmlFile.read() 
    #     components.html(source_code,width=900, height=700)
    #     # print(source_code)

    with open('style.css') as f:
        st.markdown(f'<style>{f.read()}</stle>',unsafe_allow_html=True)
    if rad=='Home':
        html_temp = """
        <div          id="container">
        <h1>Welcome to Our Website</h1>
        <p>Our advanced software will help you make sense<br>
         of your data quickly and easily. With powerful <br>
         algorithms and customizable dashboards, you'll<br>
         be able to see patterns and insights that<br>
         you never knew existed.</p>
         
        </div>
        """
        st.markdown(html_temp,unsafe_allow_html=True)
    if rad == "Visualize":
        file_upload=st.sidebar.file_uploader(" ",type=["csv"])
        st.sidebar.image(image_loan,use_column_width=True) 
        chart_select = st.sidebar.selectbox(
            label = "select the chart type",
            options=['ScatterPlots','Lineplots','Histogram','Boxplot']
        )
        html_temp = """
        <div style="background-color:red;padding:10px">
        <h2 style="color:white;text-align:center;border-radius:30px">Automatic Exploratory Analysis</h2>
        </div>
        """
        st.markdown(html_temp,unsafe_allow_html=True)
        st.sidebar.title("Upload Input csv file : ")
        st.subheader('1.Datasets')
        st.write("""
    # Automatic Exploratory Analysis
    """)


        if file_upload is not None:
            df = pd.read_csv(file_upload)
            st.write(df)
            numeric_columns = list(df.select_dtypes(['float','int']).columns)
            if chart_select == "ScatterPlots":
                st.sidebar.subheader("ScatterPlot Settings")
                x_values = st.sidebar.selectbox('X axis',options=numeric_columns)
                y_values = st.sidebar.selectbox('Y axis',options=numeric_columns)
                plot = px.scatter(data_frame =df, x=x_values,y=y_values)
                st.plotly_chart(plot)
            if chart_select == "Lineplots":
                st.sidebar.subheader("ScatterPlot Settings")
                x_values = st.sidebar.selectbox('X axis',options=numeric_columns)
                y_values = st.sidebar.selectbox('Y axis',options=numeric_columns)
                plot = px.line(data_frame =df, x=x_values,y=y_values)
                st.plotly_chart(plot)
            if chart_select=="Histogram":
                st.sidebar.subheader("ScatterPlot Settings")
                x_values = st.sidebar.selectbox('X axis',options=numeric_columns)
                y_values = st.sidebar.selectbox('Y axis',options=numeric_columns)
                plot=px.histogram(data_frame=df,x=x_values,y=y_values)
                st.plotly_chart(plot)

            if chart_select=="Boxplot":
                st.sidebar.subheader("ScatterPlot Settings")
                x_values = st.sidebar.selectbox('X axis',options=numeric_columns)
                y_values = st.sidebar.selectbox('Y axis',options=numeric_columns)
                plot=px.box(data_frame=df,x=x_values,y=y_values)
                st.plotly_chart(plot)
            
        else:
            st.info('Awaiting for CSV file to be uploaded.')
    if rad == "Analysis":
         
        file_upload=st.sidebar.file_uploader(" ",type=["csv"])
        st.sidebar.image(image_loan,use_column_width=True) 
        html_temp = """
        <div style="background-color:red;padding:10px">
        <h2 style="color:white;text-align:center;">Automatic Exploratory Analysis </h2>
        </div>
        """
        st.markdown(html_temp,unsafe_allow_html=True)
        st.sidebar.title("Upload Input csv file : ")
        st.subheader('1.Datasets')
        st.write("""
    # Automated Exploratory Analysis
    """)


        if file_upload is not None:
            df = pd.read_csv(file_upload)
            st.write(df)
            df1 = df.dropna()
            if st.button('Run Modeling'):
                st.title("Exploratory Data Analysis")
                profile_df = df.profile_report()
                st_profile_report(profile_df)
            if st.button("No. of Missing values"):
                    st.write(df.isna().sum())
            if st.button('Drop Missing values'):
                df1 = df.dropna()
                st.write(df1)
 
        else:
            st.info('Awaiting for CSV file to be uploaded.')
            if st.button('Press to use Example Datasets'):
                diabetes = load_diabetes()
                X = pd.DataFrame(diabetes.data,columns=diabetes.feature_names)
                Y = pd.Series(diabetes.target,name='response')
                df = pd.concat([X,Y],axis=1)
                st.markdown('The Diabetes dataset is used as the example.')
                st.write(df.head())
                st.markdown("Shape of Diabetes dataset")
                st.write(df.shape)
                st.title("Exploratory Data Analysis")
                profile_df = df.profile_report()
                st_profile_report(profile_df)
                st.title("Sum of Null Values")
                st.write(df.isna().sum())
                st.title("Dropping Null Values")
                df1 = df.dropna()
                data = df1.to_csv("new.csv")
                st.write(df1)
    if rad == "Machine-Learning":
            file_upload=st.sidebar.file_uploader(" ",type=["csv"])
            dataset_name = st.selectbox("Pick a dataset", ["Iris", "Breast Cancer", "Wine Quality", "Mnist Digits", "Boston Houses", 'Diabetes'])
            dataset = MLDataset(dataset_name)
            df = dataset.get_dataframe()  

            ml(df)
            
            
                
                
                
            
                

                
                

                
              
                        
                    
                    
                        
                            



if __name__ == '__main__':
    main()