countrynames
This library helps with the mapping of country names to their respective two or three letter codes. The idea is to incorporate common names for countries, and even some limited misspellings, as they occur in source data.
There is also support for fuzzy matching, which uses a heuristic based on levenshtein distance.
Usage
import countrynames
assert 'DE' == countrynames.to_code('Germany')
assert 'DE' == countrynames.to_code('Bundesrepublik Deutschland')
assert 'DE' == countrynames.to_code('Bundesrepublik Deutschlan', fuzzy=True)
assert 'DE' == countrynames.to_code('DE')
assert 'DEU' == countrynames.to_code_3('Germany')
Non-standard country codes
XKorXKX- KosovoEUorEUU- European Union
For some dissolved countries (e.g. SUHH for Soviet Union) and sub-regions
(e.g. GB-SCT for Scotland) special codes are defined and returned from both
to_code and to_code_3.
Metadata
Release files for countrynames 1.16.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| countrynames-1.16.3.tar.gz | 467.7 kB | With provenance | Details for countrynames-1.16.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| countrynames-1.16.3-py3-none-any.whl | Python 3 | none | any | Details for countrynames-1.16.3-py3-none-any.whl |
Total release size: 941.0 kB
Release files / countrynames-1.16.3.tar.gz
| Download URL | countrynames-1.16.3.tar.gz |
|---|---|
| Size | 467.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4f50be2c8416f381b7f74b0cf66abad8623306be460b9abcb36c8488d2adf3c1
|
|
BLAKE2b-256 checksum How to use checksums |
b4b08ce5c10bb75539f00f296584cab4f938fa6083626090364888322d3581fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2024.
Transparency logRelease files / countrynames-1.16.3-py3-none-any.whl
| Download URL | countrynames-1.16.3-py3-none-any.whl |
|---|---|
| Size | 473.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fa6af6cede7e8be6417857f35f940aad71ac00a1d97e4ad8d2214a8fbf081cc3
|
|
BLAKE2b-256 checksum How to use checksums |
54c098ebd1c956a32e428239651e9b87f4834ae5ce41bc972e6878a434b46b5b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2024.
Transparency logSecurity for countrynames 1.16.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for countrynames-1.16.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2024.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.