indian-pincode-geo
Post offices, coordinates, nearby search, and reverse lookup for Indian pincodes — offline, no runtime network calls.
Companion package to indian-pincode (core),
pinned to the exact same version. Install via the core package's geo extra:
pip install "indian-pincode[geo]"
Importing indian_pincode_geo also patches indian_pincode so its top-level functions
(indian_pincode.lookup(...), etc.) work — you don't need to juggle two import
statements.
Usage
import indian_pincode_geo as geo
# Post offices for a pincode
offices = geo.lookup("110001")
offices[0]["office_name"] # "New Delhi GPO"
offices[0]["office_type"] # "HO"
offices[0]["geo_quality"] # "original"
# Nearby search
nearby = geo.find_nearby(28.6304, 77.2177, radius_km=2)
nearby[0]["office_name"] # "Connaught Place SO"
nearby[0]["distance_km"] # 0.306
# Reverse geocode to nearest pincode
geo.reverse_lookup(28.6304, 77.2177) # {"pincode": "110001", "distance_km": 0.872}
# Centroid of a pincode
geo.get_centroid("110001") # {"latitude": 28.62273, "longitude": 77.21954}
API reference
| Function | Returns |
|---|---|
lookup(pin) |
list of post offices for that pincode |
find_nearby(lat, lon, radius_km=5, limit=20, include_suspect=False) |
offices within radius, sorted by distance, each with distance_km |
reverse_lookup(lat, lon) |
nearest pincode centroid: {pincode, distance_km} |
get_centroid(pin) |
{latitude, longitude} for the pincode, or None |
Plus the entire core API
(validate, get_details, list_districts, etc.), available directly from
indian_pincode once this package is imported.
Result keys are snake_case: pincode, office_name, office_type, delivery_status, district, state, state_source, latitude, longitude, geo_quality (plus distance_km on
find_nearby/reverse_lookup results). Every result carries geo_quality
("original", "swapped", or "suspect") and state_source. find_nearby and
reverse_lookup exclude "suspect" coordinates by default — pass
include_suspect=True to include them anyway. See Data quality for
what that means and how common it is.
Requirements
Python >=3.10.
Data quality
India Post's coordinates are approximate, and occasionally wrong at the source — lat/lon
swapped, or simply implausible. The build pipeline validates every coordinate against
India's bounding box, auto-corrects detected lat/lon swaps, and flags points that fall
far from their pincode's coordinate cluster as geo_quality == "suspect".
- ~6.5% of offices (10,686) are flagged
suspectand excluded fromfind_nearby/reverse_lookupby default. - ~8.4% of offices have no usable coordinates at all after cleaning (
latitude/longitudeareNone). - Full methodology and per-build stats: data/REPORT.md.
If your use case needs every point regardless of confidence (e.g. you're doing your own
outlier analysis), pass include_suspect=True — don't assume the default is "all data."
Data freshness
DATA_VERSION is the India Post snapshot date this build was compiled from (currently
2025.10.03). Releases are content-gated: you get new data when India Post actually
revises the source, not on a fixed monthly schedule.
License
- Code: MIT.
- Data: derived from India Post / data.gov.in under the Government Open Data License – India (GODL-India), which requires attribution — see DATA_LICENSE.md.
Links
- Full project README (both languages, both packages, benchmarks, FAQ)
- Core package (if you only need validation, no geo data)
- v1 → v2 migration guide
- Report a data issue
Metadata
Release files for indian-pincode-geo 2.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| indian_pincode_geo-2.1.0.tar.gz | 4.1 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| indian_pincode_geo-2.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.1 MB
Release files / indian_pincode_geo-2.1.0.tar.gz
| Download URL | indian_pincode_geo-2.1.0.tar.gz |
|---|---|
| Size | 4.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
61b781eb6330f1d7acdcf82cf3179c4800b151b40ba5124b9f1644ada4fc388c
|
|
BLAKE2b-256 checksum How to use checksums |
33b75b44a7ffda45bd812805ec32ed2d92aa255277436d2827f39e003be0d501
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 19, 2026.
Transparency logRelease files / indian_pincode_geo-2.1.0-py3-none-any.whl
| Download URL | indian_pincode_geo-2.1.0-py3-none-any.whl |
|---|---|
| Size | 4.1 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
61768d03667d195c3adc4751831cac8524441fb49a4f1165194af8478bf82312
|
|
BLAKE2b-256 checksum How to use checksums |
796961b01b4b813f14c73fac6b078f9468d1961795442eb8019a5b4d608135b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 19, 2026.
Transparency log