Julia package of information about countries, currencies and languages according to these ISO standards:
- ISO 3166-1: Countries.
- ISO 3166-2: Country subdivisions.
- ISO 4217: Currencies.
- ISO 639-3: Languages.
- ISO 15924: Scripts.
The data can be converted to any table type, allowing for easy integration into data science workflows.
The data is obtained from the Julia package
iso_codes_jll
which makes available the data from the Debian package
iso-codes
.
pkg> add Countries
julia> using Countries
julia> all_countries()
249-element Vector{Country}:
Country("AW", "ABW", "Aruba", 533, "Aruba", "Aruba", "๐ฆ๐ผ")
Country("AF", "AFG", "Afghanistan", 4, "Islamic Republic of Afghanistan", "Afghanistan", "๐ฆ๐ซ")
โฎ
Country("ZM", "ZMB", "Zambia", 894, "Republic of Zambia", "Zambia", "๐ฟ๐ฒ")
Country("ZW", "ZWE", "Zimbabwe", 716, "Republic of Zimbabwe", "Zimbabwe", "๐ฟ๐ผ")
julia> get_language("en")
Language("en", "eng", "English", "I", "L", "English", "English", "eng")
julia> filter(x->startswith(x.alpha4, "La"), all_scripts())
5-element Vector{Script}:
Script("Lana", "Tai Tham (Lanna)", 351)
Script("Laoo", "Lao", 356)
Script("Latf", "Latin (Fraktur variant)", 217)
Script("Latg", "Latin (Gaelic variant)", 216)
Script("Latn", "Latin", 215)
julia> using DataFrames
julia> DataFrame(all_currencies())
181ร3 DataFrame
Row โ alpha3 name numeric
โ String String Int16
โโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1 โ AED UAE Dirham 784
2 โ AFN Afghani 971
โฎ โ โฎ โฎ โฎ
180 โ ZMW Zambian Kwacha 967
181 โ ZWL Zimbabwe Dollar 932
julia> my_data = DataFrame(Country=["NGA", "CA", "KOR", "NZ"], Widgets=[400, 12000, 100, 3000])
4ร2 DataFrame
Row โ Country Widgets
โ String Int64
โโโโโโผโโโโโโโโโโโโโโโโโโ
1 โ NGA 400
2 โ CA 12000
3 โ KOR 100
4 โ NZ 3000
julia> my_data.Country_Name = [x.name for x in get_country.(my_data.Country)];
julia> my_data
4ร3 DataFrame
Row โ Country Widgets Country_Name
โ String Int64 String
โโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1 โ NGA 400 Nigeria
2 โ CA 12000 Canada
3 โ KOR 100 Korea, Republic of
4 โ NZ 3000 New Zealand
For each supported ISO standard, this package exports:
- a type (e.g.
Country
) to hold information about an instance from the standard; - a function (e.g.
all_countries
) returning a list of all instances; and - a lookup function (e.g.
get_country
) to get an instance from any of its codes.
Information about an instance can be obtained through its fields. All fields are strings,
except numeric
which is an integer. Optional fields may also be nothing
.
The lists also satisfy the
Tables.jl
interface, so can be converted to your favourite table type.
Standard | API | Fields |
---|---|---|
ISO 3166-1: Countries | Country , all_countries , get_country |
alpha2 , alpha3 , name , numeric , official_name , common_name , flag (optional) |
ISO 3166-2: Country Subdivisions | CountrySubdivision , all_country_subdivisions , get_country_subdivision |
code , name , type , parent (optional) |
ISO 4217: Currencies | Currency , all_currencies , get_currency |
alpha3 , name , numeric |
ISO 639-3: Languages | Language , all_languages , get_language |
alpha2 (optional), alpha3 , name , scope , type , common_name , inverted_name , bibliographic |
ISO 15924: Scripts | Script , all_scripts , get_script |
alpha4 , name , numeric |