Skip to main content

desidata

Load Indian datasets from desidata.in in one line.

import desidata

df = desidata.load("gender-policy-of-nabard-question-and-answer-dataset")

That's it — no URL copying, no sign-in, no API key. You get a pandas DataFrame of cleaned, India-focused public data: economy, agriculture, health, education, transport, demographics and more.

Install

pip install desidata

The core package has zero dependencies, so it installs instantly. load() needs pandas (almost always already installed) and will tell you exactly what to run if it is missing:

pip install desidata pandas

Usage

import desidata

# Search the catalogue from Python
results = desidata.search("census")
for row in results:
    print(row["slug"], row["category"], row["rows"])

# Browse everything, or one category
all_datasets = desidata.catalog()
economy = desidata.catalog(category="Economy")

# Metadata for one dataset
info = desidata.info("gender-policy-of-nabard-question-and-answer-dataset")
print(info["name"], info["size"], info["downloads"])

# Load as a DataFrame (kwargs pass through to pandas.read_csv)
df = desidata.load("gender-policy-of-nabard-question-and-answer-dataset")
df = desidata.load("some-dataset", dtype={"year": int}, parse_dates=["date"])

# Raw bytes, or save straight to disk
data = desidata.download("some-dataset")            # bytes
path = desidata.download("some-dataset", "a.csv")   # writes the file

Full dataset URLs work anywhere a slug does — paste straight from the browser:

desidata.load("https://www.desidata.in/datasets/gender-policy-of-nabard-question-and-answer-dataset")

Caching

Loads are cached in ~/.desidata/cache for 24 hours, so re-loading in a notebook (or in a classroom on weak wifi) is instant and offline-safe.

desidata.load("some-dataset", refresh=True)  # bypass the cache
desidata.clear_cache()                       # wipe all cached files

Set DESIDATA_CACHE_DIR to move the cache somewhere else.

Command line

desidata search nabard
desidata info gender-policy-of-nabard-question-and-answer-dataset
desidata catalog --category Agriculture
desidata download gender-policy-of-nabard-question-and-answer-dataset -o nabard.csv
desidata clear-cache

Error handling

Every error the package raises subclasses desidata.DesiDataError:

Exception Meaning
DesiDataNotFound That dataset doesn't exist (HTTP 404)
DesiDataConnectionError Network/DNS/timeout failure
DesiDataServerError desidata.in returned an unexpected error
try:
    df = desidata.load("some-slug")
except desidata.DesiDataNotFound:
    print("Check the slug with desidata.search(...)")

Development

git clone https://github.com/krishnakaushik195/desidata-py
cd desidata-py
pip install -e .[dev]
pytest                    # offline unit tests
RUN_LIVE=1 pytest tests/test_live.py -v   # integration tests against the real site

Environment overrides used by tests and local development:

Variable Purpose
DESIDATA_BASE_URL Point the client at a local/dev server
DESIDATA_CACHE_DIR Relocate the cache
DESIDATA_TIMEOUT Default request timeout in seconds

Releasing

Maintainers only:

pip install --upgrade build twine
python -m build
twine upload dist/*

Licence

MIT — see LICENSE. The data itself belongs to its sources; each dataset page on desidata.in lists its source and licence.

Metadata

Release files for desidata 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for desidata 0.1.0
File Size Uploaded
desidata-0.1.0.tar.gz 12.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for desidata 0.1.0
File Interpreter ABI Platform
desidata-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.3 kB

Release files / desidata-0.1.0.tar.gz

Download URL desidata-0.1.0.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7159d71c2a97649698dbd6f58cc5a5cc4f4fe79d27f5943bafd2ed39edda8f1e
BLAKE2b-256 checksum
How to use checksums
39be2a86020fae94a698f288f173a56bcc9582cd2528a51f32a1f59ec636f5ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / desidata-0.1.0-py3-none-any.whl

Download URL desidata-0.1.0-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
84401bf6666fa1e1b5e51512b0a83a1e6281b9516cc0713bc2e14e585e172a88
BLAKE2b-256 checksum
How to use checksums
69fcfd6184a5ed45ec7d47883d926a8b33ddf11bb3d025bfe4d75d8b50340b73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page