Spaces:
Build error
Build error
File size: 645 Bytes
ca9af8e 487aeac ca9af8e 487aeac 60911a3 ca9af8e 487aeac ca9af8e 487aeac ca9af8e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import streamlit as st
import pandas as pd
import plotly.express as px
st.title('Random Population Dataset and Treemap')
# Upload CSV
uploaded_file = st.file_uploader("Upload CSV file here", type="csv")
if uploaded_file is not None:
data = pd.read_csv(uploaded_file)
# Generate random population dataset
data = pd.DataFrame({
'Country': ['USA', 'China', 'India', 'Japan', 'Germany'],
'Population': [331002651, 1403500365, 1377233523, 126476461, 82927922]
})
# Render table
st.table(data)
# Render plotly treemap
fig = px.treemap(data, path=['Country'], values='Population', title='Global Population')
st.plotly_chart(fig) |