ECON 3209 · Week 6, Lecture 1 · Kerala Agricultural University
Autumn 2026
pd.read_csv(), pd.read_excel(), and pd.read_json() to bring data into Python.to_csv() for future analysis and reporting.sep= changes the delimiter when a file uses ; instead of ,.header= tells pandas where variable names are located.na_values= helps identify missing values such as NA, -, or missing.usecols= keeps only needed variables.parse_dates= is useful for time-series data such as monthly rubber prices.pd.read_excel() is common for cooperative bank branch records.pd.read_json() is useful when data arrive in nested web formats.df.to_csv() stores a clean version for later econometric work.index=False.head().info().to_csv().A good rule: never run a regression on data you have not inspected.
-, or n.a..| Package | Install | What it gives you |
|---|---|---|
mospi-unitdata |
pip install mospi-unitdata |
Unit-level microdata — download raw NSS, PLFS, ASI datasets from microdata.gov.in |
mospi-esankhyiki |
pip install mospi-esankhyiki |
Aggregate indicators — 500+ statistical series across 22 datasets (PLFS, CPI, IIP, NAS, WPI …) |
Both packages are official MOSPI/NSO tools (MIT licence). mospi-unitdata requires a free API key; mospi-esankhyiki is fully open.
Run these in a local Python environment (Jupyter / terminal) — they call live government APIs that are not available inside the browser sandbox.
# pip install mospi-unitdata
from MospiUnitdata import list_datasets, list_files, download_file
API_KEY = "YOUR_KEY" # get free key at microdata.gov.in → Profile
# 1. Search available surveys
datasets = list_datasets(API_KEY, query="labour force")
for d in datasets:
print(f"{d['idno']}: {d['title']}")
# DDI-IND-NSO-PLFS-2023-24: Periodic Labour Force Survey 2023-24
# DDI-IND-NSO-PLFS-2022-23: Periodic Labour Force Survey 2022-23
# 2. See files in a dataset
files = list_files("DDI-IND-NSO-PLFS-2023-24", API_KEY)
for f in files:
print(f['name'], f.get('size', '?'))
# 3. Download to your project
download_file("DDI-IND-NSO-PLFS-2023-24",
"PLFS_2023_24_Visit1_CSV.zip", "./data", API_KEY)Once downloaded: pd.read_csv("./data/PLFS_2023_24_Visit1_CSV.zip") — one row per household member.
# pip install mospi-esankhyiki
import esankhyiki
# Step 1 – discover the 22 datasets
datasets_df = esankhyiki.list_datasets(format="df")
# Step 2 – see indicators for PLFS (Periodic Labour Force Survey)
indicators = esankhyiki.get_indicators("PLFS")
# Step 3 – find valid filter codes (years, states, sectors …)
meta = esankhyiki.get_metadata("PLFS", indicator_code=3, frequency_code=1)
# Step 4 – fetch as DataFrame
df = esankhyiki.get_data("PLFS", {
"indicator_code": 3, # Unemployment Rate
"frequency_code": 1, # Annual
"year": "2023-24",
"state_code": 99, # All India
"gender_code": 3, # Persons (all)
"age_code": 1,
"sector_code": 3, # Rural + Urban
}, format="df")
print(df)Other useful datasets: "CPI", "NAS" (GDP), "IIP", "HCES" (consumption/poverty), "ASI", "WPI"
Once you call esankhyiki.get_data(..., format="df") locally, the DataFrame has this same structure — ready for regression or visualisation.
A cooperative bank officer gives you a semicolon-separated file with columns branch, loans, and recovery_rate. Write code to import the data, convert loans to numeric, and export a clean CSV preview without row numbers.
pd.read_csv(), pd.read_excel(), and pd.read_json() are core import tools.to_csv(index=False) helps save a clean analysis-ready dataset.mospi-unitdata — downloads raw NSS/PLFS/ASI unit-level microdata from microdata.gov.in via Python API.mospi-esankhyiki — fetches 500+ aggregate indicators (PLFS, CPI, NAS, IIP …) directly as DataFrames in 4 steps.ECON 3209 — Kerala Agricultural University