Spaces:
Sleeping
Sleeping
Update pages/income.py
Browse files- pages/income.py +6 -1
pages/income.py
CHANGED
|
@@ -16,8 +16,10 @@ yay = pd.merge(income_long, mortality_long, on=['country', 'year'])
|
|
| 16 |
yer = yay.dropna()
|
| 17 |
yer = yer[yer["year"] <= 2024]
|
| 18 |
|
| 19 |
-
st.title("Child Mortality vs Daily Income
|
| 20 |
|
|
|
|
|
|
|
| 21 |
yeyear = st.slider("Select a Year", min_value=yer["year"].min(), max_value=2024, value=2024)
|
| 22 |
|
| 23 |
filtered_yer = yer[yer["year"] == yeyear]
|
|
@@ -34,3 +36,6 @@ scatter_plot = alt.Chart(filtered_yer).mark_circle(size=60).encode(
|
|
| 34 |
)
|
| 35 |
|
| 36 |
st.altair_chart(scatter_plot, use_container_width=True)
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
yer = yay.dropna()
|
| 17 |
yer = yer[yer["year"] <= 2024]
|
| 18 |
|
| 19 |
+
st.title("Child Mortality vs Daily Income")
|
| 20 |
|
| 21 |
+
st.text("From our earlier exploration of the data from part 1, we cleaned the data, where we removed around 2500 missing values which we deemed to not make a significant difference. Furthermore, we made sure to change the data appropriately such as changing the data type for the year into an integer. We also filtered the data so the max year is 2024, as the dataset included projected quantities for future years.")
|
| 22 |
+
st.text("We examine child mortality deaths as our y-variable and daily income as our x-variable. The average daily income is the mean daily household per capita income. The mortality rate is the death of children under five years of age per 1000 live births. After cleaning the dataset, it contains 57195 rows × 4 columns with country, year, income, and mortality.")
|
| 23 |
yeyear = st.slider("Select a Year", min_value=yer["year"].min(), max_value=2024, value=2024)
|
| 24 |
|
| 25 |
filtered_yer = yer[yer["year"] == yeyear]
|
|
|
|
| 36 |
)
|
| 37 |
|
| 38 |
st.altair_chart(scatter_plot, use_container_width=True)
|
| 39 |
+
|
| 40 |
+
st.text("In Streamlit, we create an interactive slider that allows the user to choose a year where the earliest year is 1800 and the maximum year is 2024. In Altair, we create a scatter plot where the x-axis is represented by daily income (USD) set to a logarithmic scale for better visualization for larger income ranges, and the y-axis is represented by child mortality (per 1,000). Each country is assigned a unique color and we incorporate a hover tooltip to show the country, year, income, and mortality rate for a specific data point.
|
| 41 |
+
")
|