Untitled

mail@pastecode.io avatar
unknown
plain_text
25 days ago
613 B
3
Indexable
Never
filtered_df = df[(df['Date'] >= start_date) & (df['Date'] <= end_date)]
if devices:
    filtered_df = filtered_df[filtered_df['Device Name'].isin(devices)]
if circles:
    filtered_df = filtered_df[filtered_df['Circle'].isin(circles)]

# Aggregate usage
usage_totals = filtered_df.groupby('Date')['Usage in GB'].sum().reset_index()

# Create Altair chart
chart = alt.Chart(usage_totals).mark_line(point=True).encode(
    x='Date:T',
    y='Usage in GB:Q',
    tooltip=['Date:T', 'Usage in GB:Q']
).properties(
    title='Total Usage Over Time'
)

st.altair_chart(chart, use_container_width=True)
Leave a Comment