Skip to main content

中国行政区域数据

根据中华人民共和国民政部中的数据处理而成。

由于时间跨度过长(从 1980 年至今),故而部分地区的名称或行政级别已经发生改变,本仓库的存储原则为“编码唯一,以新换旧”。即同一个行政编码,认定为同一个地区,地区名称以民政部门最新公开的行政区域划分数据中的名称为准。且,为保持向前兼容,一些过去存在但后来去除的行政区域编码,本仓库仍然保留,以方便一些古旧的数据能正常使用。

安装

pip install china-region-data

样例

from china_region_data import Region


广东 = Region("广东省")
深圳 = Region("广东省深圳市")
南山 = Region("广东省深圳市南山区")
assert 广东.name == "广东省"
assert 广东.level == 1

for 广东城市 in 广东.subordinate:
    assert 广东城市.level == 2

assert 深圳.superior == 广东
assert 南山.superior.superior == 广东
assert 南山 in 南山.superior
assert 南山 in 南山.superior.superior

北京 = Region("110000")
assert 北京.name == 北京.fullname == "北京市"
assert 北京 not in 广东

Metadata

Release files for china-region-data 2020.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for china-region-data 2020.10
File Size Uploaded Provenance Actions
china-region-data-2020.10.tar.gz 53.8 kB Without provenance Details for china-region-data-2020.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for china-region-data 2020.10
File Interpreter ABI Platform Actions
china_region_data-2020.10-py3-none-any.whl Python 3 none any Details for china_region_data-2020.10-py3-none-any.whl

Total release size: 108.1 kB

Release files / china-region-data-2020.10.tar.gz

Download URL china-region-data-2020.10.tar.gz
Size 53.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2098a1fdc620ff2f2049575b1da2db5e2d3068264c6bb82c04728aba8b75565b
BLAKE2b-256 checksum
How to use checksums
b2d369b0335f05d21dc5a5d4b9ae36c43e1ceeb07d2f99fdbe2e8a187880bc0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.7.4 Windows/10

Release files / china_region_data-2020.10-py3-none-any.whl

Download URL china_region_data-2020.10-py3-none-any.whl
Size 54.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dab54d96567c904a7d93c8bdadd7e2743bc746cf40e7083c530a60495e1060b2
BLAKE2b-256 checksum
How to use checksums
ad3f4b3352d41ec5c50c174a978e60cc35bbf959009f2668545a9e929a5ed81d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.7.4 Windows/10

Security for china-region-data 2020.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page