diff --git a/.DS_Store b/.DS_Store index abe74b0..85e7f17 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/ContinentsPHS.ipynb b/ContinentsPHS.ipynb new file mode 100644 index 0000000..9942f53 --- /dev/null +++ b/ContinentsPHS.ipynb @@ -0,0 +1,68 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "31c78300-b0ea-4e03-979f-b8f12a55a4df", + "metadata": {}, + "outputs": [], + "source": [ + "import pandas as pd\n", + "\n", + "# Load your CSV\n", + "df = pd.read_csv(\"FilteredPHSbySES.csv\")\n", + "\n", + "# Define full mapping\n", + "country_to_continent = {\n", + " 'POL': 'Europe', 'NZL': 'Oceania', 'FRA': 'Europe', 'USA': 'North America', 'CAN': 'North America',\n", + " 'AUS': 'Oceania', 'JPN': 'Asia', 'KOR': 'Asia', 'MEX': 'North America', 'CHL': 'South America',\n", + " 'DEU': 'Europe', 'ITA': 'Europe', 'ESP': 'Europe', 'SWE': 'Europe', 'NOR': 'Europe', 'DNK': 'Europe',\n", + " 'FIN': 'Europe', 'NLD': 'Europe', 'BEL': 'Europe', 'CHE': 'Europe', 'GBR': 'Europe', 'IRL': 'Europe',\n", + " 'AUT': 'Europe', 'COL': 'South America', 'SVK': 'Europe', 'GRC': 'Europe', 'TUR': 'Europe',\n", + " 'HUN': 'Europe', 'LTU': 'Europe', 'CZE': 'Europe', 'EST': 'Europe', 'HRV': 'Europe', 'SVN': 'Europe',\n", + " 'BGR': 'Europe', 'PRT': 'Europe', 'LVA': 'Europe', 'ISR': 'Asia', 'LUX': 'Europe', 'ROU': 'Europe',\n", + " 'ISL': 'Europe'\n", + "}\n", + "\n", + "# Update the ACTION column with continent mapping, then rename to CONTINENT\n", + "if 'ACTION' in df.columns:\n", + " df['ACTION'] = df['REF_AREA'].map(country_to_continent)\n", + " df.rename(columns={'ACTION': 'CONTINENT'}, inplace=True)\n", + "else:\n", + " df['CONTINENT'] = df['REF_AREA'].map(country_to_continent)\n", + "\n", + "# Save the updated file if needed\n", + "df.to_csv(\"PHSwithContinent.csv\", index=False)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c29ebc0a-0d73-4541-b860-fec52aef9561", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python [conda env:base] *", + "language": "python", + "name": "conda-base-py" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.7" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}