Skip to main content

A python library for accessing official statistics of Japan.

Project description

jpstat

A python package for accessing the official statistics of Japan.

Features

Install

pip install jpstat

estat API

estat is the official statistics site 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 key words

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

To dowload data

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

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

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 scrapes 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 to scrape 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")

Use the information of data id and file type ("EXCEL"/"CSV"/"PDF") in estatFile.get_list to download the file. The file would be downloaded to current folder by default

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jpstat-0.0.3.1.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

jpstat-0.0.3.1-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file jpstat-0.0.3.1.tar.gz.

File metadata

  • Download URL: jpstat-0.0.3.1.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.10 CPython/3.8.5 Darwin/20.1.0

File hashes

Hashes for jpstat-0.0.3.1.tar.gz
Algorithm Hash digest
SHA256 c91c44c36880798263c6ec368062d79222bd0750825a675d3b83683cc264483a
MD5 9c2622d35fd1982e3f6118a8bb12c6d0
BLAKE2b-256 80aa5cf2ef4a495355470c920c8a4f37be035d6c602735756fc544d63cadf578

See more details on using hashes here.

File details

Details for the file jpstat-0.0.3.1-py3-none-any.whl.

File metadata

  • Download URL: jpstat-0.0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.10 CPython/3.8.5 Darwin/20.1.0

File hashes

Hashes for jpstat-0.0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b601c551c66e853b9773e740a50361089a039100fc073e7430d1fa0ad34634c6
MD5 d90ae0a1936bbe9294359f8e9b6df837
BLAKE2b-256 fdf74648f0f11bf23b56cef6d440825543033517d9052bfbffb10128076494b0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page