Examplemi / app.py
Harshitn24's picture
Update app.py
511b495 verified
import streamlit as st
import pandas as pd
# Load data from a CSV file
csv_file = 'Bengaluru_House_Data.csv' # Replace with your CSV file path
df = pd.read_csv(csv_file)
# Set the title of the web app
st.title("CSV Data Table and Select Boxes Example")
# Define the options for the select boxes
options1 = ["Low", "Medium", "High"]
options2 = ["Option A", "Option B", "Option C"]
options3 = ["Choice X", "Choice Y", "Choice Z"]
# Create the select boxes
growth = st.selectbox("Growth", options1, index=0)
income = st.selectbox("Income", options2, index=0)
budget = st.selectbox("Budget", options3, index=0)
# Function to handle selection changes
st.write(f"Selected Growth: {growth}")
st.write(f"Selected Income: {income}")
st.write(f"Selected Budget: {budget}")
# Display the dataframe as a table
st.dataframe(df)
# Optionally, you can add some styling
st.markdown("""
<style>
.stDataFrame {
border: 2px solid black;
}
.stDataFrame thead th {
background-color: lightblue;
font-weight: bold;
color: black;
}
.stDataFrame tbody td {
border: 1px solid black;
}
</style>
""", unsafe_allow_html=True)