From dffe784704ca221b14c4e5e58fa77210ac2adc31 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Tue, 12 Dec 2023 17:07:33 +0100 Subject: [PATCH] address pandas 2.1.4 deprecation warnings on applymap and fillna(method='bfill') --- scripts/build_shapes.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/build_shapes.py b/scripts/build_shapes.py index fa707ad5..35bae147 100644 --- a/scripts/build_shapes.py +++ b/scripts/build_shapes.py @@ -174,8 +174,8 @@ def nuts3(country_shapes, nuts3, nuts3pop, nuts3gdp, ch_cantons, ch_popgdp): pd.MultiIndex.from_tuples(pop.pop("unit,geo\\time").str.split(",")) ) .loc["THS"] - .applymap(lambda x: pd.to_numeric(x, errors="coerce")) - .fillna(method="bfill", axis=1) + .map(lambda x: pd.to_numeric(x, errors="coerce")) + .bfill(axis=1) )["2014"] gdp = pd.read_table(nuts3gdp, na_values=[":"], delimiter=" ?\t", engine="python") @@ -184,8 +184,8 @@ def nuts3(country_shapes, nuts3, nuts3pop, nuts3gdp, ch_cantons, ch_popgdp): pd.MultiIndex.from_tuples(gdp.pop("unit,geo\\time").str.split(",")) ) .loc["EUR_HAB"] - .applymap(lambda x: pd.to_numeric(x, errors="coerce")) - .fillna(method="bfill", axis=1) + .map(lambda x: pd.to_numeric(x, errors="coerce")) + .bfill(axis=1) )["2014"] cantons = pd.read_csv(ch_cantons)