I have some CSV which I want to see as a dashboard, so I can easily explore the data. - Create a dropzone where a user can drop his csv. Once drop, render a table + Interactive charts showing transaction trends, project type distributions, and geographic breakdowns transaction_id,date,project_type,project_id,seller,buyer,quantity,price_per_ton,total_value,standard,vintage_year,location TR-12493,2024-01-15,Reforestation,PRJ-4587,Carbon Forest Partners,GreenInvest Group,5000,12.50,62500.00,Gold Standard,2023,Brazil TR-12494,2024-01-17,Renewable Energy,PRJ-2839,SunPower Solutions,Eco Capital Fund,3200,9.75,31200.00,VCS,2023,India TR-12495,2024-01-21,Methane Capture,PRJ-6721,AgriTech Emissions,Climate Forward,2800,14.25,39900.00,CAR,2023,United States
Drop files here
or click to upload
import streamlit as st
import pandas as pd
import altair as alt
st.title('CSV Data Dashboard')
# Create a file uploader for CSV files
uploaded_file = st.file_uploader('Drop your CSV file here', type=['csv'])
if uploaded_file is not None:
# Read and display the CSV data
df = pd.read_csv(uploaded_file)
st.dataframe(df)
# Transaction Trends Chart
transaction_chart = alt.Chart(df).mark_line().encode(
x='date:T',
y='sum(total_value):Q',
tooltip=['date:T', 'sum(total_value):Q']
).properties(title='Transaction Trends')
st.altair_chart(transaction_chart, use_container_width=True)
# Project Type Distribution Chart
project_type_chart = alt.Chart(df).mark_bar().encode(
x='project_type:N',
y='count():Q',
color='project_type:N',
tooltip=['project_type:N', 'count():Q']
).properties(title='Project Type Distribution')
st.altair_chart(project_type_chart, use_container_width=True)
# Geographic Breakdown Chart
location_chart = alt.Chart(df).mark_arc().encode(
theta='count():Q',
color='location:N',
tooltip=['location:N', 'count():Q']
).properties(title='Geographic Breakdown')
st.altair_chart(location_chart, use_container_width=True)
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?