Skip to content

Commit

Permalink
✨ add historical + projections
Browse files Browse the repository at this point in the history
  • Loading branch information
paarriagadap committed Dec 10, 2024
1 parent 7fde773 commit 60e17c7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ definitions:
Estimates are based on household surveys or extrapolated up until the year of the data release using GDP growth estimates and forecasts. For more details about the methodology, please refer to the [World Bank PIP documentation](https://datanalytics.worldbank.org/PIP-Methodology/lineupestimates.html#nowcasts).
<% elif scenario == "Current forecast + historical growth" %>
This data is a projection of the estimates based on GDP growth projections from the World Bank's Global Economic Prospects and the the Macro Poverty Outlook, together with IMF's World Economic Outlook, in the period 2025-2029. For the period 2030-2050, the data is projected using the average annual historical GDP per capita growth over 2010-2019.
<% elif scenario == "Historical + current forecast + historical growth" %>
This data combines data based on household surveys or extrapolated up until the year of the data release using GDP growth estimates and forecasts, with projections based on GDP growth projections from the World Bank's Global Economic Prospects and the the Macro Poverty Outlook, together with IMF's World Economic Outlook, in the period 2025-2029. For the period 2030-2050, the data is projected using the average annual historical GDP per capita growth over 2010-2019.
<% elif scenario == "2% growth" %>
This data is a projection of the estimates based on a scenario of 2% average GDP per capita growth, while keeping income inequality constant.
<% elif scenario == "2% growth + Gini reduction 1%" %>
Expand All @@ -48,7 +50,7 @@ definitions:
<%- endif -%>
isprojection_by_scenario: |-
<% if scenario == "Historical" %>
<% if scenario == "Historical" or scenario == "Historical + current forecast + historical growth" %>
false
<% else %>
true
Expand Down
16 changes: 16 additions & 0 deletions etl/steps/data/garden/wb/2024-12-03/poverty_projections.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ def connect_estimates_with_projections(tb: Table) -> Table:

tb = tb.copy()

# Save tb_historical and tb_current_forecast, by filtering scenario in historical and current_forecast
tb_historical = tb[tb["scenario"] == "historical"].copy().reset_index(drop=True)
tb_current_forecast = tb[tb["scenario"] == "current_forecast"].copy().reset_index(drop=True)

# Make table wider, by using scenario as columns
tb = tb.pivot(index=["country", "year", "povertyline"], columns="scenario", values=INDICATOR_COLUMNS)

Expand All @@ -116,4 +120,16 @@ def connect_estimates_with_projections(tb: Table) -> Table:
for indicator in INDICATOR_COLUMNS:
tb[indicator] = tb[indicator].copy_metadata(tb["country"])

# Combine historical and current_forecast, by concatenating tb_historical and tb_current_forecast
tb_connected = pr.concat([tb_historical, tb_current_forecast], ignore_index=True)

# Rename scenario column to "Historical + current forecast + historical growth"
tb_connected["scenario"] = "Historical + current forecast + historical growth"

# Keep only the columns in INDEX_COLUMNS and INDICATOR_COLUMNS
tb_connected = tb_connected[INDEX_COLUMNS + INDICATOR_COLUMNS]

# Concatenate tb and tb_connected
tb = pr.concat([tb, tb_connected], ignore_index=True)

return tb

0 comments on commit 60e17c7

Please sign in to comment.