diff --git a/src/bblocks_data_importers/who/ghed.py b/src/bblocks_data_importers/who/ghed.py index 6990cd5..cb2641a 100644 --- a/src/bblocks_data_importers/who/ghed.py +++ b/src/bblocks_data_importers/who/ghed.py @@ -135,8 +135,8 @@ def _format_main_data(self) -> pd.DataFrame: return ( pd.read_excel(self._raw_data, sheet_name="Data", dtype_backend="pyarrow") .drop(columns=["region", "income"]) - .melt(id_vars=["country", "code", "year"], var_name="indicator_code") - .rename(columns={"country": Fields.country_name, "code": Fields.iso3_code}) + .melt(id_vars=["location", "code", "year"], var_name="indicator_code") + .rename(columns={"location": Fields.country_name, "code": Fields.iso3_code}) .pipe(convert_dtypes) ) @@ -189,7 +189,7 @@ def _format_metadata(self) -> pd.DataFrame: """ cols = { - "country": Fields.country_name, + "location": Fields.country_name, "code": Fields.iso3_code, "variable name": Fields.indicator_name, "variable code": Fields.indicator_code, @@ -197,7 +197,7 @@ def _format_metadata(self) -> pd.DataFrame: "Comments": "comments", "Data type": "data_type", "Methods of estimation": "methods_of_estimation", - "Country footnote": "country_footnote", + "Countries and territories footnote": "country_footnote", } try: diff --git a/tests/test_data/test_ghed.XLSX b/tests/test_data/test_ghed.XLSX index 1800bcc..453c40c 100644 Binary files a/tests/test_data/test_ghed.XLSX and b/tests/test_data/test_ghed.XLSX differ diff --git a/tests/test_who/test_ghed.py b/tests/test_who/test_ghed.py index 8341b55..1c7c4c2 100644 --- a/tests/test_who/test_ghed.py +++ b/tests/test_who/test_ghed.py @@ -198,7 +198,7 @@ def test_format_data_missing_columns(mock_raw_data): # format the raw data to remove a required column raw_df = pd.read_excel(mock_raw_data, sheet_name="Data") - raw_df.drop(columns=["country"], inplace=True) + raw_df.drop(columns=["location"], inplace=True) modified_raw_data = io.BytesIO() with pd.ExcelWriter(modified_raw_data, engine="xlsxwriter") as writer: raw_df.to_excel(writer, sheet_name="Data")