Skip to main content

NSO1212v1

National Statistical Office of Mongolia's Open Data API v1 Handler for Python

A lightweight Python client for accessing the 1212.mn National Statistics Office of Mongolia API. This package simplifies data retrieval by converting API responses into clean, easy-to-analyze pandas DataFrames.


Features

  • Retrieve sectors, subsectors, tables, table meta data, and data from 1212.mn.
  • Validate query parameters before sending API requests.
  • Handle language selection (mn or en).
  • Convert JSON responses into pandas.DataFrame objects for convenient analysis.
  • Support for JSON formatted responses.

Installation

pip install NSO1212v1

Or install directly from source:

git clone https://github.com/makhgal-ganbold/NSO1212v1
cd NSO1212v1
pip install .

Dependencies

  • pandas
  • requests
  • itertools (standard library)

Install dependencies with:

pip install pandas requests

Quick Start

import NSO1212v1 as nso

# Get list of all sectors

sectors = nso.sectors(language="en")
sector_id = sectors.id[5]

# Get subsectors of a sector

subsectors = nso.subsectors(sector_id, language="en")
subsector_id = subsectors.id[0]

# Get tables available under a subsector

tables = nso.tables(sector_id, subsector_id, language="en")
table_id = tables.id[5]

# Get metadata of a specific table

table = nso.table(sector_id, subsector_id, table_id, language="en")
table["variables"]

# Query actual data

query = {
  "query": [
    {
      "code": "Байршил",
      "selection": {
        "filter": "item",
        "values": ["0"]
      }
    },
    {
      "code": "Бүс",
      "selection": {
        "filter": "item",
        "values": ["0"]
      }
    },
    {
      "code": "Он",
      "selection": {
        "filter": "item",
        "values": ["0", "1"]
      }
    }
  ],
  "response": {
    "format": "json-stat2"
  }
}
data = nso.data(sector_id, subsector_id, table_id, query=query, language="en")

# The API response contains both raw JSON and a DataFrame
data
data["df"]

Author

Makhgal Ganbold, National University of Mongolia

Copyright

© 2025 Makhgal Ganbold

Metadata

Release files for NSO1212v1 1.0.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 NSO1212v1 1.0.0
File Size Uploaded
nso1212v1-1.0.0.tar.gz 6.3 kB Details

Built distribution (wheel)

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

Total release size: 13.7 kB

Release files / nso1212v1-1.0.0.tar.gz

Download URL nso1212v1-1.0.0.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
07472fc8aa70256e2a2ec41893704bd97facf2b6d207c8ae39f96fbb2e85a9de
BLAKE2b-256 checksum
How to use checksums
b621cf4513508345bef2e3926beee793b3cc50daafc5160642b8aac3347313c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / nso1212v1-1.0.0-py3-none-any.whl

Download URL nso1212v1-1.0.0-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c043d74f82b6943d1e64d4754b0d734c4aa4a83ec661a93d8cbd1866630956a
BLAKE2b-256 checksum
How to use checksums
8ec672b4c087c9f063d3aae573d0310c09e2eb489c01e147302cf595030474d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.0.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