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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nso1212v1-1.0.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nso1212v1-1.0.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file nso1212v1-1.0.0.tar.gz.

File metadata

  • Download URL: nso1212v1-1.0.0.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for nso1212v1-1.0.0.tar.gz
Algorithm Hash digest
SHA256 07472fc8aa70256e2a2ec41893704bd97facf2b6d207c8ae39f96fbb2e85a9de
MD5 b4153de2a1efc74f859702483e4cd268
BLAKE2b-256 b621cf4513508345bef2e3926beee793b3cc50daafc5160642b8aac3347313c6

See more details on using hashes here.

File details

Details for the file nso1212v1-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: nso1212v1-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for nso1212v1-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4c043d74f82b6943d1e64d4754b0d734c4aa4a83ec661a93d8cbd1866630956a
MD5 b5dc7b948015385cd106adc6fe5e6f0b
BLAKE2b-256 8ec672b4c087c9f063d3aae573d0310c09e2eb489c01e147302cf595030474d8

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page