Metadata-Version: 2.4
Name: nbsdata
Version: 0.2.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
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

Download `whl` file (say, 'nbsdata-0.1.0-py3-none-any.whl') from github release page, and install with pip

```
pip install nbsdata-0.1.0-py3-none-any.whl
```

## 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

To update these files, run related function yn 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', 'A020101', 'LAST5')
```

### Regional Data

quarterly data of urban disposable income of Zhejiang

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