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

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()

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.

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

data = 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.2.tar.gz (11.1 kB view hashes)

Uploaded Source

Built Distribution

jpstat-0.0.2-py3-none-any.whl (13.2 kB view hashes)

Uploaded Python 3

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