### Install Development Dependencies with uv Source: https://pypi.org/project/cn-stats Use this command to install all necessary development dependencies for the project. ```bash # 安装开发依赖 uv sync ``` -------------------------------- ### Fetch Monthly Monetary Data Source: https://pypi.org/project/cn-stats Example of fetching monthly monetary supply data (M2, M1, M0) for a specific month. The output includes the indicator name, code, query date, and the corresponding value. ```bash $ uv run cnstats A0D01 202201 +---------------------------------+----------+----------+------------+ | 指标名称 | 指标代码 | 查询日期 | 数值 | +---------------------------------+----------+----------+------------+ | 货币和准货币(M2)供应量_期末值 | A0D0101 | 202201 | 2431022.72 | | 货币和准货币(M2)供应量_同比增长 | A010102 | 202201 | 9.8 | | 货币(M1)供应量_期末值 | A0D0103 | 202201 | 613859.35 | | 货币(M1)供应量_同比增长 | A0D0104 | 202201 | -1.9 | | 流通中现金(M0)供应量_期末值 | A0D0105 | 202201 | 106188.87 | | 流通中现金(M0)供应量_同比增长 | A0D0106 | 202201 | 18.5 | +---------------------------------+----------+----------+------------+ ``` -------------------------------- ### Fetch City Data for Multiple Months Source: https://pypi.org/project/cn-stats This example shows how to fetch city-level data for multiple months using a specific indicator code and region code. The output includes indicator name, code, region name, region code, query date, and value. ```bash $ uv run cnstats A010101 202201 --regcode 370200 +------------------------------------+----------+----------+----------+----------+-------+ | 指标名称 | 指标代码 | 地区名称 | 地区代码 | 查询日期 | 数值 | +------------------------------------+----------+----------+----------+----------+-------+ | 城市居民消费价格指数(上年同月=100) | A010101 | 青岛 | 370200 | 202201 | 101.3 | +------------------------------------+----------+----------+----------+----------+-------+ ``` -------------------------------- ### Fetch Provincial Data for Multiple Months Source: https://pypi.org/project/cn-stats Example of retrieving provincial data for multiple months using a specific indicator code and region code. Note that for data from 2021 onwards, indicator codes like A01010B are recommended. ```bash $ uv run cnstats A01010B01 202112,202201 --regcode 110000 +--------------------------------+-----------+----------+----------+----------+-------+ | 指标名称 | 指标代码 | 地区名称 | 地区代码 | 查询日期 | 数值 | +--------------------------------+-----------+----------+----------+----------+-------+ | 居民消费价格指数(上年同月=100) | A01010B01 | 北京市 | 110000 | 202201 | 101.3 | | 居民消费价格指数(上年同月=100) | A01010B01 | 北京市 | 110000 | 202112 | 101.8 | +--------------------------------+-----------+----------+----------+----------+-------+ ``` -------------------------------- ### Display Help Information Source: https://pypi.org/project/cn-stats Use the --help flag to display available commands and options for the cn-stats tool. This is useful for understanding the full range of functionalities. ```bash # If in local development uv run cnstats --help # Or traditional direct call python -m cnstats --help ``` -------------------------------- ### Run Tests with uv Source: https://pypi.org/project/cn-stats Execute project tests using pytest, managed by uv. ```bash # 运行测试 uv run pytest ``` -------------------------------- ### Fetch Multiple Months of Monetary Data Source: https://pypi.org/project/cn-stats Demonstrates fetching monetary supply data for multiple consecutive months. This allows for trend analysis by comparing values across different dates. ```bash $ uv run cnstats A0D01 202112,202201 +---------------------------------+----------+----------+------------+ | 指标名称 | 指标代码 | 查询日期 | 数值 | +---------------------------------+----------+----------+------------+ | 货币和准货币(M2)供应量_期末值 | A0D0101 | 202201 | 2431022.72 | | 货币和准货币(M2)供应量_期末值 | A0D0101 | 202112 | 2382899.56 | | 货币和准货币(M2)供应量_同比增长 | A0D0102 | 202201 | 9.8 | | 货币和准货币(M2)供应量_同比增长 | A0D0102 | 202112 | 9.0 | | 货币(M1)供应量_期末值 | A0D0103 | 202201 | 613859.35 | | 货币(M1)供应量_期末值 | A0D0103 | 202112 | 647443.35 | | 货币(M1)供应量_同比增长 | A0D0104 | 202201 | -1.9 | | 货币(M1)供应量_同比增长 | A0D0104 | 202112 | 3.5 | | 流通中现金(M0)供应量_期末值 | A0D0105 | 202201 | 106188.87 | | 流通中现金(M0)供应量_期末值 | A0D0105 | 202112 | 90825.15 | | 流通中现金(M0)供应量_同比增长 | A0D0106 | 202201 | 18.5 | | 流通中现金(M0)供应量_同比增长 | A0D0106 | 202112 | 7.7 | +---------------------------------+----------+----------+------------+ ``` -------------------------------- ### cn-stats Command Line Arguments Source: https://pypi.org/project/cn-stats This shows the available arguments and options for the cn-stats command, including positional arguments for indicator and date, and optional flags for data filtering and output formatting. ```bash usage: cn-stats [-h] [--tree] [--list-regcode] [--dbcode [DBCODE]] [--regcode [REGCODE]] [zbcode] [date] Get data from China National Bureau of Statistics website Python package positional arguments: zbcode Indicator code date Query date options: -h, --help show this help message and exit --tree List indicator codes, can append [zbcode] to view sub-indicators --list-regcode List region codes, default lists provincial codes, add --dbcode csnd to list major city codes --dbcode [DBCODE] Database code, default: hgyd (macro monthly), optional: hgjd (macro quarterly), hgnd (macro annual), fsyd (provincial monthly), fsjd (provincial quarterly), fsnd (provincial annual), csyd (city monthly), csjd (city quarterly), csnd (city annual) --regcode [REGCODE] Region code, e.g., 110000 for Beijing ``` -------------------------------- ### Find Latest Indicator Codes with --tree Source: https://pypi.org/project/cn-stats Use the --tree option to explore the hierarchy of indicator codes within a specific database. This is useful for finding updated or sub-category codes, especially when data is missing for older codes. ```bash # View sub-categories and time period descriptions under A0101 (Consumer Price Index) in the provincial monthly database $ uv run cnstats A0101 --tree --dbcode fsyd ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.