Metadata-Version: 2.4
Name: cnstats-py
Version: 0.0.4
Summary: Download macroeconomic data from China's National Bureau of Statistics (data.stats.gov.cn).
Author-email: Clsrfish <clsrfish@gmail.com>
Project-URL: Homepage, https://github.com/clsrfish/cnstats-py
Project-URL: Bug Tracker, https://github.com/clsrfish/cnstats-py/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests
Requires-Dist: pandas
Provides-Extra: excel
Requires-Dist: openpyxl; extra == "excel"
Provides-Extra: dev
Requires-Dist: black; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Dynamic: license-file

# cnstats-py

[![PyPI](https://github.com/clsrfish/cnstats-py/actions/workflows/publish.yml/badge.svg?branch=master&event=push)](https://github.com/clsrfish/cnstats-py/actions/workflows/publish.yml)

A Python package to easily download macroeconomic data from the National Bureau of Statistics of China (<https://data.stats.gov.cn>).

## Installation

```bash
pip install cnstats-py
# or
pipenv install cnstats-py
```

## Basic Usage

```python
import cnstats

# Example: Get data for a specific indicator and year
data: pd.DataFrame = cnstats.query_data(DBCode.hgyd, "A01010G", "2024")
print(data.shape)
```

In terminal:

```bash
python -m cnstats query_data --dbcode hgyd --zbcode A01010G --sj 2024
```

## Features

- Fetch data from the National Bureau of Statistics of China
- Support for multiple databases and indicators
- Easy to use command line interface
- Data is returned as a pandas DataFrame for easy manipulation and analysis
- Support for multiple data formats (CSV, DTA, etc.)

## Contributing

Contributions are welcome! Please open an issue or submit a pull request.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
