| import altair as alt | |
| import pandas as pd | |
| import streamlit as st | |
| # Read the dataset | |
| df = pd.read_csv('dataset.csv') | |
| # Calculate the sum of calories | |
| calories_sum = df['calories'].sum() | |
| # Create a dataframe with the sum of calories | |
| calories_df = pd.DataFrame({'calories': [calories_sum]}, index=['Total']) | |
| # Create the chart | |
| chart = alt.Chart(calories_df).mark_bar().encode( | |
| x='calories:Q', | |
| y='sum(calories):Q' | |
| ) | |
| # Display the chart | |
| st.altair_chart(chart, use_container_width=True) |