Spaces:
Build error
Build error
| 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) |