us-zip-census
uszipcensus is a lightweight Python package that converts US ZIP codes into their corresponding Census Division and Region names.
GitHub Repo: https://github.com/kris-szczepaniak/us-zip-census
Features
- Works with both 5-digit or 5+4-digit format.
Division Mapping: Converts a valid ZIP code to its corresponding Census Division.Region Mapping: Maps a valid ZIP code to its Census Region.
Installation
Install uszipcensus via pip:
pip install uszipcensus
Usage
Import the package and call the functions directly:
import uszipcensus
division = uszipcensus.zip_to_division("12345")
region = uszipcensus.zip_to_region("12345")
print("Division:", division)
print("Region:", region)
API Overview
-
zip_to_division(zip_code: str) -> str
Validates the ZIP code and returns the name of the Census Division. Raises a ValueError if the ZIP code is invalid or if the division cannot be determined. -
zip_to_region(zip_code: str) -> str
Converts a ZIP code to its Census Region by first mapping it to a division. Raises a ValueError if the region cannot be determined.
Contributing
Contributions are welcome! Please open an issue or submit a pull request with your improvements.
Acknowledgements
This package uses a great package zipcodes.
Please find it here: https://pypi.org/project/zipcodes/
Metadata
Release files for us-zip-census 0.1.5
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 |
|---|---|---|---|---|
| us_zip_census-0.1.5.tar.gz | 2.9 kB | Without provenance | Details for us_zip_census-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| us_zip_census-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for us_zip_census-0.1.5-py3-none-any.whl |
Total release size: 6.9 kB
Release files / us_zip_census-0.1.5.tar.gz
| Download URL | us_zip_census-0.1.5.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
40a10eb55a0286cdacd1073a69c5b01695c026fe4db47c0699f252de2352267f
|
|
BLAKE2b-256 checksum How to use checksums |
ced4705f4a33de7feb88ea1c278ee3e9469b15326a889cdeca9dc2d6336fa559
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.2 CPython/3.12.5 Darwin/24.2.0
|
Release files / us_zip_census-0.1.5-py3-none-any.whl
| Download URL | us_zip_census-0.1.5-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
750920e2fe2ab8632853e7d7690578fc9e33a6b0043799da1d3ad9c903e649b0
|
|
BLAKE2b-256 checksum How to use checksums |
14139edd87caab0d65b528e80eb3a8b94bbd3b6f3a4a4f9adc473f7f1e390fd9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.2 CPython/3.12.5 Darwin/24.2.0
|
Security for us-zip-census 0.1.5
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.