Skip to main content

jpstat

A python package for accessing the official statistics of Japan.

Features

Install

pip install jpstat

estat API

estat is the official site for government statistics in Japan. Its api service offers data of over 250+ statistics in Japan. You need to register an api key to access to the statistics.

Functions

All functions return one or multiple pandas DataFrames.

To see a list of statistics offered by estat api

import jpstat
stat = jpstat.estat.get_stat(key=YOUR_API_KEY)

To search data by either the code of a statistic or some keywords

data = jpstat.estat.get_list(statsCode="00400001")
data = jpstat.estat.get_list(searchWord="企業")

To download data and data note

data, note = jpstat.estat.get_data(statsDataId="0000040001")

If there is an error related to accessing the data note, one can simply suppress outputting it by

data = jpstat.estat.get_data(statsDataId="0000040001", return_note=False)

Configuration

You can pass the estat api key to each function. Or you can set a configuration

jpstat.options["estat.api_key"] = "MY_API_KEY"

You can also set the language from Japanese (default, "J") to English (However it is strongly recommended to use "J" as it often returns more information about the data)

jpstat.options["estat.lang"] = "E"

To see a list of valid configuration options

jpstat.config.describe_options()

estat File

Many statistics and datasets in estat can not be accessed through API, but are excel, csv, or pdf files and can be downloaded. Here jpstat provides the functions that scrape the information of statistics and download the files. Api key for estat is not needed, and the result is in Japanese only.

Functions

To see a list of all statistics in estat that have downloadable files

data = jpstat.estatFile.get_stat()

It will take some time to scraping the website of estat at the first time and then save the list to options["estat.data_dir"]. From then on, the function would first try to read the local file. You can force scraping again by setting update=True.

To search data files by code of a statistic and the survey year (optional)

data = jpstat.estatFile.get_list(statsCode="00400001")
data = jpstat.estatFile.get_list(statsCode="00400001", year="1950")

Again, you can save the result by setting save=True, and from next time jpstat would first check if the result already exists.

To download the file by using the information of data id and file type ("EXCEL"/"CSV"/"PDF") gotten from the result of estatFile.get_list

jpstat.estatFile.get_file(statsDataId="000029094935", file_type="EXCEL")

The file would be downloaded to current folder by default.

Metadata

Release files for jpstat 0.0.5

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

Source distribution (sdist)

Source distribution for jpstat 0.0.5
File Size Uploaded Provenance
jpstat-0.0.5.tar.gz 13.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for jpstat 0.0.5
File Interpreter ABI Platform
jpstat-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 28.0 kB

Release files / jpstat-0.0.5.tar.gz

Download URL jpstat-0.0.5.tar.gz
Size 13.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1540f9201122a28e7a210249b98ffdeeae745b2701261b77ff9d84b5ffa2cfd3
BLAKE2b-256 checksum
How to use checksums
8bec288649f31f6fbd9a74c3d3c948eaf1b4d68cc80e8a6f6cd503d30c17ff4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.10 CPython/3.8.12 Darwin/22.4.0

Release files / jpstat-0.0.5-py3-none-any.whl

Download URL jpstat-0.0.5-py3-none-any.whl
Size 14.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
72c3ae9632babdb8f0b96435207f63f6fcaffd8f249a6e7afa1ef9b77a099381
BLAKE2b-256 checksum
How to use checksums
15719b1e4f9ed0ed295872b469c01400c0039309f64ee3c3ad1f3b5213d9cf10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.10 CPython/3.8.12 Darwin/22.4.0

Security for jpstat 0.0.5

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.

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