I need a dashboard. On the top of the page there is a combobox with week numbers in a year (current week is the default number). Next line has two groups, both with the same design: a header and three values. Third line is the same the second line. Below these lines there is a table with 7*10 size.
To upload files, please first save the app
import streamlit as st
import pandas as pd
from datetime import datetime, timedelta
# Get current week number
current_week = datetime.now().isocalendar()[1]
# Generate list of weeks for the year
weeks = list(range(1, 53)) # Most years have 52 weeks, some have 53
# Layout
st.title("Dashboard")
# Week selector
selected_week = st.selectbox("Select Week", weeks, index=current_week-1)
# Create two columns for the first row of metrics
col1, col2 = st.columns(2)
# First group
with col1:
st.markdown("### Group 1")
metric1, metric2, metric3 = st.columns(3)
with metric1:
st.metric("Metric 1", "100")
with metric2:
st.metric("Metric 2", "200")
with metric3:
st.metric("Metric 3", "300")
# Second group
with col2:
st.markdown("### Group 2")
metric4, metric5, metric6 = st.columns(3)
with metric4:
st.metric("Metric 4", "400")
with metric5:
st.metric("Metric 5", "500")
with metric6:
st.metric("Metric 6", "600")
# Create two columns for the second row of metrics
col3, col4 = st.columns(2)
# Third group
with col3:
st.markdown("### Group 3")
metric7, metric8, metric9 = st.columns(3)
with metric7:
st.metric("Metric 7", "700")
with metric8:
st.metric("Metric 8", "800")
with metric9:
st.metric("Metric 9", "900")
# Fourth group
with col4:
st.markdown("### Group 4")
metric10, metric11, metric12 = st.columns(3)
with metric10:
st.metric("Metric 10", "1000")
with metric11:
st.metric("Metric 11", "1100")
with metric12:
st.metric("Metric 12", "1200")
# Generate sample data for the table (7 columns x 10 rows)
data = {
'Monday': [f"Data {i+1}" for i in range(10)],
'Tuesday': [f"Data {i+1}" for i in range(10)],
'Wednesday': [f"Data {i+1}" for i in range(10)],
'Thursday': [f"Data {i+1}" for i in range(10)],
'Friday': [f"Data {i+1}" for i in range(10)],
'Saturday': [f"Data {i+1}" for i in range(10)],
'Sunday': [f"Data {i+1}" for i in range(10)]
}
# Create and display the table
df = pd.DataFrame(data)
st.markdown("### Weekly Data")
st.table(df)
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?