Skip to content

Commit

Permalink
fix: code country OO does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorentLvr committed Apr 5, 2024
1 parent 6bd3009 commit 7a5ff0d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@
"import openai\n",
"import time\n",
"from googlesearch import search\n",
"import re\n",
"import pycountry"
"import re"
]
},
{
Expand Down Expand Up @@ -450,16 +449,6 @@
},
"outputs": [],
"source": [
"def get_country_name(country_code):\n",
" country_name = \"Not Found\"\n",
" if str(country_code) != \"None\":\n",
" try:\n",
" country = pycountry.countries.get(alpha_2=country_code)\n",
" country_name = country.name\n",
" except Exception as e:\n",
" print(e)\n",
" return country_name\n",
"\n",
"def enrich_organizations(\n",
" df_init,\n",
" output_dir,\n",
Expand Down
29 changes: 28 additions & 1 deletion utils/data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
"from naas_drivers import linkedin\n",
"import naas_data_product\n",
"import shutil\n",
"import pandas as pd"
"import pandas as pd\n",
"import pycountry"
]
},
{
Expand All @@ -70,6 +71,32 @@
"## Model"
]
},
{
"cell_type": "markdown",
"id": "5d0cb0b8-ba48-4ceb-91c0-c4001d7e78f8",
"metadata": {},
"source": [
"### Get country name"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a6cb615f-d36f-455e-9c3e-decef98f1ea3",
"metadata": {},
"outputs": [],
"source": [
"def get_country_name(country_code):\n",
" country_name = \"Not Found\"\n",
" if str(country_code) not in [\"None\", \"OO\"] :\n",
" try:\n",
" country = pycountry.countries.get(alpha_2=country_code)\n",
" country_name = country.name\n",
" except Exception as e:\n",
" print(e)\n",
" return country_name"
]
},
{
"cell_type": "markdown",
"id": "a30d711f-aacb-44cf-ae31-636f96976a75",
Expand Down

0 comments on commit 7a5ff0d

Please sign in to comment.