File size: 818 Bytes
478d45f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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)