Spaces:
Build error
Build error
| import streamlit as st | |
| import pandas as pd | |
| import plotly.express as px | |
| st.title("Dashboard Example") | |
| # File uploader | |
| uploaded_file = st.file_uploader("Upload CSV for Dashboard", type=["csv"]) | |
| if uploaded_file: | |
| data = pd.read_csv(uploaded_file) | |
| st.sidebar.title("Dashboard Controls") | |
| # Sidebar controls | |
| column = st.sidebar.selectbox("Select column to analyze:", data.columns) | |
| chart_type = st.sidebar.selectbox("Choose chart type:", ["Bar", "Line", "Scatter"]) | |
| # Display summary | |
| st.write("Summary Statistics:") | |
| st.write(data.describe()) | |
| # Generate chart | |
| if chart_type == "Bar": | |
| st.bar_chart(data[column]) | |
| elif chart_type == "Line": | |
| st.line_chart(data[column]) | |
| else: | |
| fig = px.scatter(data, x=data.index, y=column) | |
| st.plotly_chart(fig) | |