Skip to content

Commit 9012afb

Browse files
committed
add iso1366 to python organisers
1 parent 62aab3a commit 9012afb

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

utils/import_python_organizers.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from datetime import datetime
22
import pandas as pd
3+
import iso3166
34
import urllib
45
import sys
56
from pathlib import Path
@@ -112,6 +113,12 @@ def main(year=None, base=""):
112113

113114
# Write the new data to the CSV file
114115
df_csv.loc[:, "Location"] = df_csv.place
116+
df_csv.loc[:, "Country"] = (
117+
df_csv.place.str.split(",")
118+
.str[-1]
119+
.str.strip()
120+
.apply(lambda x: iso3166.countries_by_name.get(x.upper(), iso3166.Country("", "", "", "", "")).alpha3)
121+
)
115122
write_csv(df_csv, year, csv_location)
116123

117124

utils/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
pandas
22
thefuzz
33
icalendar
4+
iso3166

0 commit comments

Comments
 (0)