File size: 1,439 Bytes
51da677
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st
import pandas as pd

# Page Config
st.set_page_config(page_title="AutoML - Classification", layout="wide")

st.title("Classification Data")

# Upload button
uploaded_file = st.file_uploader("Upload Data", type=["csv", "json", "xml", "xlsx"])

if uploaded_file is not None:
    file_extension = uploaded_file.name.split(".")[-1]
    
    # Read dataset based on file type
    if file_extension == "csv":
        df = pd.read_csv(uploaded_file)
    elif file_extension == "json":
        df = pd.read_json(uploaded_file)
    elif file_extension == "xml":
        df = pd.read_xml(uploaded_file)
    elif file_extension == "xlsx":
        df = pd.read_excel(uploaded_file)
    
    st.success("File uploaded successfully!")
    
    # Dropdown to select basic info
    options = ["Head of Data", "Data Info", "Describe Data"]
    selected_option = st.selectbox("Select Basic Info to View", options)
    
    if selected_option == "Head of Data":
        st.write(df.head())
    elif selected_option == "Data Info":
        buffer = []
        df.info(buf=buffer)
        s = "\n".join(str(x) for x in buffer)
        st.text(s)
    elif selected_option == "Describe Data":
        st.write(df.describe())

    # Submit button to redirect to EDA page
    if st.button("Submit"):
        st.session_state["uploaded_df"] = df  # Store data in session state
        st.switch_page("pages/1_EDA.py")  # Redirect to EDA page