Spaces:
Runtime error
Runtime error
import streamlit as st | |
# Define the state populations and family sizes | |
state_data = { | |
'California': {'population': 39538223, 'family_size': 3.3}, | |
'Texas': {'population': 29145505, 'family_size': 3.4}, | |
'Florida': {'population': 21538187, 'family_size': 3.0}, | |
'New York': {'population': 19849399, 'family_size': 3.1}, | |
'Minnesota': {'population': 5700671, 'family_size': 2.5}, | |
'Wisconsin': {'population': 5897473, 'family_size': 2.6}, | |
} | |
# Define the state spending data | |
spending_data = { | |
'California': {'education': 2500, 'healthcare': 3000, 'transportation': 1500}, | |
'Texas': {'education': 2000, 'healthcare': 2500, 'transportation': 1000}, | |
'Florida': {'education': 1500, 'healthcare': 2000, 'transportation': 750}, | |
'New York': {'education': 3000, 'healthcare': 3500, 'transportation': 2000}, | |
'Minnesota': {'education': 1000, 'healthcare': 1500, 'transportation': 500}, | |
'Wisconsin': {'education': 1250, 'healthcare': 1750, 'transportation': 750}, | |
} | |
# Define the emoji icons | |
POPULATION_ICON = 'π₯' | |
FAMILY_SIZE_ICON = 'π¨βπ©βπ§βπ¦' | |
EDUCATION_ICON = 'π«' | |
HEALTHCARE_ICON = 'π₯' | |
TRANSPORTATION_ICON = 'π' | |
def main(): | |
st.title('State Comparison') | |
# Display state populations and family sizes | |
st.header('Population and Family Size') | |
for state, data in state_data.items(): | |
st.subheader(f'{POPULATION_ICON} {state}') | |
st.write(f'Population: {data["population"]}') | |
st.write(f'Family Size: {data["family_size"]}') | |
# Display state spending data | |
st.header('State Spending') | |
for state, data in spending_data.items(): | |
st.subheader(state) | |
st.write(f'{EDUCATION_ICON} Education: {data["education"]}') | |
st.write(f'{HEALTHCARE_ICON} Healthcare: {data["healthcare"]}') | |
st.write(f'{TRANSPORTATION_ICON} Transportation: {data["transportation"]}') | |
if __name__ == '__main__': | |
main() | |