Metadata-Version: 2.4
Name: nbsdata
Version: 0.0.0
Summary: data from National Bureau of Statistics, China
Author-email: Rho Zhang <rhozhang@163.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/rhozhang/nbsdata
Project-URL: Issues, https://github.com/rhozhang/nbsdata/issues
Keywords: data,nbs,China
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: Development Status :: 4 - Beta
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests
Requires-Dist: polars
Dynamic: license-file

# Retrieving Data from China National Bureau of Statistics

<https://data.stats.gov.cn/easyquery.htm>

## Installation

```
pip install nbsdata
```

## Usage

```
from nbsdata import NBS
bs = NBS()
```

### Get Databases

```
bs.databases
```

### Get Region Codes

```
bs.regioncode('浙江')   # 330000
bs.regioncode('杭州', city = True)   # 330100
```

### Query Indicator Codes

Indicator codes for each database are retrived with module `get_nbs_indicators` (in directory 'rhopy')

Indicator data files are stored in package's 'asset' directory. The indicators are somewhat stable. We will update them if needed.

To update these files, run related function in module 'get_nbs_indicators'

```
bs.indicatorcode('csnd', '生产总值')
```

NB: only indicators on selection bar on the left in the official pages (excluding indicators appear in the table only ) are available

### National Data

annual data of GDP

```
bs.nationaldata('hgnd', 'A0201', 'LAST5')
```

### Regional Data

quarterly data of urban disposable income of Zhejiang

```
bs.regionaldata('fsjd', 'A0301', '2010A-2025C', '330000')
```
