tips-analyzer / app.py
HarshaX's picture
Upload 4 files
2a6b09f verified
Raw
History Blame Contribute Delete
1.38 kB
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.")