Skip to main content

Indian Zip Codes

Project description

zipcodes-in

zipcode

✍ Description of the project

Zipcodes-in is a Python library built for querying India zipcodes, post offices and particular state/UT. Py Package can be installed from here.

📊 Data description and preparation

  • Data was extracted from here
  • Cleaned the data and extracted all the values for India (IN). Script can be found here
  • Finally, the data was converted from CSV to JSON. The data can be found here

📍 Functionalities

  • Query if a zipcode matches or not
  • List random zipcodes
  • Validate of a zipcode exists or not
  • List top N zipcodes
  • List any random N zipcodes
  • List all the zipcodes in the dataset (absolutely NOT recommended!)

💻 Installation

# Install the package 
>>> pip install zipcodes-in

Zipcodes-in supports Python 3.6+

👩‍💻 Running Scripts

>>> from zipcode_script import zipcode
>>> print(zipcode)
Zipcode class to validate and fetch data of provided India zipcode

>>> # Zipcode matching
>>> print(zipcode.matching('834001'))
[{'zipcode': '834001', 
'region': 'Ranchi', 
'state_ut': 'Jharkhand', 
'country': 'India', 
'latitude': '23.3505', 
'longitude': '85.2927', 
'post_office': 'Argora.'}]

# Print random zipcodes 
>>> print(zipcode.random())
{'zipcode': '177601', 
'region': 'Hamirpur(HP)', 
'state_ut': 'Himachal Pradesh', 
'country': 'India', 
'latitude': '31.7124', 
'longitude': '76.4841', 
'post_office': 'Badhani'}

>>> # Print N random zipcodes 
>>> print(zipcode.listRandomN(3))
[{'zipcode': '711410', 
'region': 'Howrah', 
'state_ut': 'West Bengal', 
'country': 'India', 
'latitude': '22.526', 
'longitude': '88.0676', 
'post_office': 'Paikpara'}, 
{'zipcode': '585107', 
'region': 'Kalaburagi', 
'state_ut': 'Karnataka', 
'country': 'India', 
'latitude': '17.2967', 
'longitude': '76.6671', 
'post_office': 'Kalaburagi HCB'}, 
{'zipcode': '688539', 
'region': 'Alappuzha', 
'state_ut': 'Kerala', 
'country': 'India', 
'latitude': '9.7869', 
'longitude': '76.3235', 
'post_office': 'Varanad'}]

>>> # Print top N zipcodes
>>> print(zipcode.listTopN(2))
[{'zipcode': '110001', 
'region': 'New Delhi', 
'state_ut': 'Delhi', 
'country': 'India', 
'latitude': '28.6369', 
'longitude': '77.2183', 
'post_office': 'New Delhi G.P.O.'}, 
{'zipcode': '110002', 
'region': 'New Delhi', 
'state_ut': 'Delhi', 
'country': 'India', 
'latitude': '28.6453', 
'longitude': '77.2456', 
'post_office': 'Civic Centre'}]

NOTE: Version 1.0 is tested on Windows10. 
## If you face any issue while running, please raise an issue on this repository

⚠️ The zipcode data was last updated on: Jul. 27th, 2021 ⚠️

Looking forward to make the project better? 🤔

We are open to suggestions and ideas! Feel free to raise an issue and we shall get back to you super soon!

📑 LICENSE

MIT LICENSE

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

zipcodes-in-0.2.0.tar.gz (328.9 kB view details)

Uploaded Source

Built Distribution

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

zipcodes_in-0.2.0-py3-none-any.whl (356.9 kB view details)

Uploaded Python 3

File details

Details for the file zipcodes-in-0.2.0.tar.gz.

File metadata

  • Download URL: zipcodes-in-0.2.0.tar.gz
  • Upload date:
  • Size: 328.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.3

File hashes

Hashes for zipcodes-in-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4767b1dde5210bea4c14807c77d68393dd0bfc80c74827eb2bd4af1a295601db
MD5 fc69dbe8401e8294952d960dc4305246
BLAKE2b-256 9645b5d8fbb661033a920e2df04734fcbd346406830028062319a4b0946192f4

See more details on using hashes here.

File details

Details for the file zipcodes_in-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: zipcodes_in-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 356.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.3

File hashes

Hashes for zipcodes_in-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1754f06a84c74dd28ff835ed4b59ec3ecbf6871522ee95952b5ba614b426f5ab
MD5 5d19cdabf16ef86ea7cf87948b6f9565
BLAKE2b-256 87e01c8027a103455c52d903ae4dcba441f50e2969ff448102415b4c9db408a7

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