Skip to main content

Lookup NUTS codes from country and ZIP code

Project description

nuts-lookup

Quick lookup of NUTS codes (NUTS-0, NUTS-1, NUTS-2, NUTS-3) by country (Alpha-2) and postal code using a compact in-memory SQLite database.

Installation

pip install nuts-lookup

Python API

from nuts_lookup import NutsLookup

lookup = NutsLookup()
print(lookup.get_nuts_code("DE", "10115"))    # Example: 'DE300' (NUTS-3)
print(lookup.get_nuts2_code("DE", "10115"))   # Example: 'DE30'  (NUTS-2)
print(lookup.get_nuts1_code("DE", "10115"))   # Example: 'DE3'   (NUTS-1)
print(lookup.get_nuts0_code("DE", "10115"))   # Example: 'DE'    (NUTS-0)

CLI

After installation, the nuts-lookup command is available:

nuts-lookup <COUNTRY_CODE> <POSTAL_CODE> [--level 0|1|2|3]
  • --level specifies the desired NUTS level (0, 1, 2, or 3). Default is 3 (NUTS-3).

Examples:

nuts-lookup DE 10115           # Outputs NUTS-3 code (e.g. DE300)
nuts-lookup DE 10115 --level 2 # Outputs NUTS-2 code (e.g. DE30)
nuts-lookup DE 10115 --level 1 # Outputs NUTS-1 code (e.g. DE3)
nuts-lookup DE 10115 --level 0 # Outputs NUTS-0 code (e.g. DE)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nuts_lookup-1.0.0.tar.gz (9.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nuts_lookup-1.0.0-py3-none-any.whl (10.0 MB view details)

Uploaded Python 3

File details

Details for the file nuts_lookup-1.0.0.tar.gz.

File metadata

  • Download URL: nuts_lookup-1.0.0.tar.gz
  • Upload date:
  • Size: 9.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.1

File hashes

Hashes for nuts_lookup-1.0.0.tar.gz
Algorithm Hash digest
SHA256 a1b005a49fc6507c57ef19382bb91149370ff97fbe61d3384553a4afd0318847
MD5 594d93f9211570c3789e5ba44df469c3
BLAKE2b-256 fa70d817279157b9bd4669a807a4b636ad471896759f03c824be24949773b432

See more details on using hashes here.

File details

Details for the file nuts_lookup-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: nuts_lookup-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.1

File hashes

Hashes for nuts_lookup-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e65b6eebcb2543bdb3dcfd10fcb73f86cb81a2dc89c99152bde94037d0cdecc5
MD5 3d72ebf68de2a7e1bb52122f98c16ce0
BLAKE2b-256 fdb8a714fd1b3dbe5f08db797eca08ee13a33f34ec37ea267d1f573c7e4d3c62

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page