File size: 1,379 Bytes
2a6b09f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st

# Sidebar for navigation
st.sidebar.title("🧭 Navigation")
option = st.sidebar.radio("Choose a module", ["Tips Dataset Explorer", "Tips Dataset Dashboard", "Basic Viewer"])

# Conditional loading based on sidebar selection
if option == "Tips Dataset Explorer":
    from pages import project_1

elif option == "Tips Dataset Dashboard":
    from pages import project_2

elif option == "Basic Viewer":
    import pandas as pd

    st.markdown("<h1 style='text-align: center; color: teal;'>πŸ“Š Tips Dataset Viewer</h1>", unsafe_allow_html=True)

    file = st.file_uploader("πŸ“ Upload a CSV file", type=["csv"])
    if file is not None:
        df = pd.read_csv(file)

        st.markdown("### 🧾 Full DataFrame")
        st.dataframe(df)

        st.markdown("### πŸ” First 5 Rows")
        st.write(df.head())

        st.markdown("### πŸ”Ž Last 5 Rows")
        st.write(df.tail())

        st.markdown("### πŸ“š Feature Types")
        categorical_cols = df.select_dtypes(include='object').columns.tolist()
        numerical_cols = df.select_dtypes(include=['int64', 'float64']).columns.tolist()

        st.write("🟨 **Categorical Features:**", categorical_cols)
        st.write("🟦 **Numerical Features:**", numerical_cols)
    else:
        st.info("⬆️ Please upload a CSV file to get started.")