japancode
japancode は、日本の都道府県・市区町村名や各種番号・記号(全国地方公共団体コードなど)を取得・変換するための Python ライブラリです。
現在の対応データ
(現在は都道府県レベルのみ対応しています)
- 都道府県名 (漢字、ひらがな、カタカナ)
- 全国地方公共団体コード (LGコード)
- JIS X 0401 (都道府県コード)
- ISO 3166-2
インストール
pip install japancode
使い方
都道府県名のローマ字表記
from japancode import roman
print(roman("東京都")) # => 'tokyo'
print(roman("東京都", capitalize=True)) # => 'Tokyo'
都道府県名のひらがな・カタカナ表記
from kana import kana
print(kana("東京都")) # => 'とうきょうと'
print(kana("東京都", katakana=True)) # => 'トウキョウト'
全国地方公共団体コード
from japancode import lgcode
print(lgcode.tocode("東京都")) # => '130001'
print(lgcode.reverse("130001")) # => '東京都'
JIS X 0401 (都道府県コード)
from japancode import jiscode
print(jiscode.tocode("東京都")) # => '13'
print(jiscode.reverse("13")) # => '東京都'
ISO 3166-2
from japancode import isocode
print(isocode.tocode("東京都")) # => 'JP-13'
print(isocode.reverse("JP-13")) # => '東京都'
開発・テスト
poetry install
poetry run pytest poetry run pytest ./japancode --doctest-modules --cov -vs
ロードマップ
- 郵便番号
- 市区町村レベルのコード
- 地域メッシュ
- ローマ字の長音表記対応
-
normalize -
shorten - ドキュメントの整備
クレジット
- code4fukui/localgovjp : list of local government in Japan (日本の地方自治体一覧オープンデータ) JSON/CSV (CC0)
ライセンス
MIT
Metadata
Release files for japancode 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| japancode-0.1.0.tar.gz | 64.0 kB | Without provenance | Details for japancode-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| japancode-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for japancode-0.1.0-py3-none-any.whl |
Total release size: 131.4 kB
Release files / japancode-0.1.0.tar.gz
| Download URL | japancode-0.1.0.tar.gz |
|---|---|
| Size | 64.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fac5ba31c303a39adf228c44effaa50c98fa9e19a9876dea44de3bebb931c012
|
|
BLAKE2b-256 checksum How to use checksums |
410b1c27d7e63f3c3b85bf0ffb5804abf99e89d0f4c14ec88667ca01396cb7ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.4 Darwin/21.6.0
|
Release files / japancode-0.1.0-py3-none-any.whl
| Download URL | japancode-0.1.0-py3-none-any.whl |
|---|---|
| Size | 67.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
018cbd49becabe01a2c9a7aeca9c3994a58e52655360f9afaa0397b609a3a46b
|
|
BLAKE2b-256 checksum How to use checksums |
703ec71bd7e838952c4eedc3d61f50d791df5c9270714b3e7578f3ab3f6af20b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.4 Darwin/21.6.0
|
Security for japancode 0.1.0
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.