File size: 491 Bytes
182219d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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)