Skip to main content

India's states and cities

Project description

India package


Version 1.1.5


Installation Using pip

pip install pyindia

Running Tests

python -m unittest discover -s tests


This repository makes it easy to access metadata of states and union territories of India.

>>> import india
>>> india.states.AR
OUT: <State: Arunachal Pradesh>

You can also lookup whether your input is state or not.

>>> import india
>>> india.states.lookup('arunachal pradesh')
OUT: <State: Arunachal Pradesh>

New release enables you to access districts/cities across india with several attributes

>>> import india
>>> india.cities.KA_BLR
OUT: <City: Bangalore>

Lookup for cities

>>> import india
>>> india.cities.lookup('Bangalore')
OUT: <City: Bangalore>

Check whether the city is capital

>>> import india
>>> india.cities.lookup('Bangalore').iscapital()
OUT: True


Attributes of state object       # name of the state    # returns the capital of that state
state.population # returns the population of the state
state.area       # returns the area of state in km^2
state.density    # returns population density per km^2 of state
state.language   # primary official language of the state

Attributes of Cities object       # name of the city
city.state      # returns the state of city
city.population # returns the population of the city
city.area       # returns the area of the district
city.density    # returns population density per km^2 of the city
city.url        # returns official webpage of the city

Release Notes

  • Added cities of india with there attributes and states they belong to.
  • Added attributes to state objects including population, area and language.
  • Added cities string access.
  • Added states string access.
  • Added uts string access.
  • Added Jammu and Kashmir and Ladhakh as Union territories.
  • 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

    pyindia-1.1.5.tar.gz (150.7 kB view hashes)

    Uploaded source

    Built Distribution

    pyindia-1.1.5-py3-none-any.whl (152.7 kB view hashes)

    Uploaded py3

    Supported by

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