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")

Create a free token in DesiData Profile & settings and set DD_TOKEN in your environment before downloading. Public catalogue search needs no token. You get a pandas DataFrame of cleaned, India-focused public data: economy, agriculture, health, education, transport, demographics and more.

Install

pip install --upgrade "desidata[pandas]>=0.1.1"

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 --upgrade "desidata[pandas]>=0.1.1" 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 Override the public catalogue API only; downloads require the trusted production origin
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.

Authenticated downloads (0.1.1)

In a fresh Colab session:

%pip install --upgrade "desidata[pandas]>=0.1.1"
from google.colab import userdata
import os
os.environ["DD_TOKEN"] = userdata.get("DD_TOKEN")
import desidata
df = desidata.load("udise-2024-25-education-statistics-question-and-answer-dataset")
df.head()

Enable notebook access to the DD_TOKEN secret. Restart the runtime after upgrading if desidata was already imported. Never print the token or signed download URLs. The SDK authenticates only to https://www.desidata.in, parses download_url JSON, and fetches the HTTPS file separately with no bearer header. Redirects are rejected on both requests. DESIDATA_BASE_URL overrides apply only to catalogue calls.

Fresh cached CSVs remain usable offline without a token. Expired entries and refresh=True require authentication; failed refreshes preserve the old file. DesiDataAuthenticationError indicates a missing/invalid/revoked token; DesiDataPermissionError indicates API permission denial; DesiDataResponseError indicates malformed JSON or an unsafe file URL; DesiDataSignedUrlError indicates an expired or rejected storage link (retry with refresh=True).

Metadata

Release files for desidata 0.1.1

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.1
File Size Uploaded Provenance Actions
desidata-0.1.1.tar.gz 16.0 kB With provenance Details for desidata-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 27.8 kB

Release files / desidata-0.1.1.tar.gz

Download URL desidata-0.1.1.tar.gz
Size 16.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a04dc59ed77362ab7af3a1ebd16d5c5bce962cc755472c257a6ba489280ded96
BLAKE2b-256 checksum
How to use checksums
e02e337a385bb24a0768a587c2b31b2ebafe3fdb792e917278c8a6e7c3f2cc35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 26, 2026.

Transparency log

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

Download URL desidata-0.1.1-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
03af571959a72a5a6e3b214da30409b11d4e9c9a78384e851a7216afea403747
BLAKE2b-256 checksum
How to use checksums
f30166484e918463ab1a0d2d851db5e2906fa57ed08df3ff784298f2ec8af3ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 26, 2026.

Transparency log

Security for desidata 0.1.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for desidata-0.1.1.tar.gz

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 Oct 26, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

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