From f5ac15839183886731d25092c4322bcfcb42a4d5 Mon Sep 17 00:00:00 2001 From: lucasrodes Date: Tue, 3 Dec 2024 20:06:28 +0100 Subject: [PATCH] add rate --- .../data/garden/demography/2024-11-26/multiple_births.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/etl/steps/data/garden/demography/2024-11-26/multiple_births.py b/etl/steps/data/garden/demography/2024-11-26/multiple_births.py index f482ce66f46..eafd3129e47 100644 --- a/etl/steps/data/garden/demography/2024-11-26/multiple_births.py +++ b/etl/steps/data/garden/demography/2024-11-26/multiple_births.py @@ -103,7 +103,7 @@ def run(dest_dir: str) -> None: # Estimate ratios tb["children_delivery_ratio"] = ( - 1_000 * (tb["multiple_children"] + tb["singletons"]) / tb["multiple_deliveries"] + 1_000 * (tb["multiple_children"] + tb["singletons"]) / tb["total_deliveries"] ).round(3) tb["children_multiple_delivery_ratio"] = (1_000 * tb["multiple_children"] / tb["multiple_deliveries"]).round(3) tb["multiple_to_singleton_ratio"] = (1_000 * tb["multiple_deliveries"] / tb["singletons"]).round(3) @@ -113,12 +113,12 @@ def run(dest_dir: str) -> None: assert ( tb.loc[flag, "children_multiple_delivery_ratio"] >= 4000 ).all(), "Unexpected outlier for England and Wales in 1938" - tb.loc[flag, ["multiple_children", "children_multiple_delivery_ratio"]] = pd.NA + tb.loc[flag, ["multiple_children", "children_multiple_delivery_ratio", "children_delivery_ratio"]] = pd.NA flag = (tb["country"] == "England and Wales") & (tb["year"] == 1939) assert ( tb.loc[flag, "children_multiple_delivery_ratio"] <= 1500 ).all(), "Unexpected outlier for England and Wales in 1938" - tb.loc[flag, ["multiple_children", "children_multiple_delivery_ratio"]] = pd.NA + tb.loc[flag, ["multiple_children", "children_multiple_delivery_ratio", "children_delivery_ratio"]] = pd.NA # Keep relevant columns tb = tb[