Skip to main content

Library to handle JSON-stat data in python using pandas DataFrames.

Project description

pyjstat is a python library for JSON-stat formatted data manipulation which allows reading and writing JSON-stat [1] format with python,using the DataFrame structures provided by the widely accepted pandas library [2]. The JSON-stat format is a simple lightweight JSON format for data dissemination. Pyjstat is inspired in rjstat [3], a library to read and write JSON-stat with R, by ajschumacher. Note that, like in the rjstat project, not all features are supported (i.e. not all metadata are converted). pyjstat is provided under the Apache License 2.0.

Installation

pyjstat requires pandas package. For installation:

pip install pyjstat

Usage

From JSON-stat to pandas DataFrame

Typical usage often looks like this:

from pyjstat import pyjstat
import urllib2
import json

results = pyjstat.from_json_stat(json.load(urllib2.urlopen(
                         'http://json-stat.org/samples/oecd-canada.json')))
print results

From pandas DataFrame to JSON-stat

The same data can be converted into JSON-stat, with some unavoidable metadata loss:

from pyjstat import pyjstat
import urllib2
import json

results = pyjstat.from_json_stat(json.load(urllib2.urlopen(
                         'http://json-stat.org/samples/oecd-canada.json')))
print pyjstat.to_json_stat(results)

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

pyjstat-0.1.8.tar.gz (164.5 kB view details)

Uploaded Source

File details

Details for the file pyjstat-0.1.8.tar.gz.

File metadata

  • Download URL: pyjstat-0.1.8.tar.gz
  • Upload date:
  • Size: 164.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyjstat-0.1.8.tar.gz
Algorithm Hash digest
SHA256 15358b1a10821cfc76e42843568b25a49aaad3566ef7488f2afdce4cc7317988
MD5 9dc730257399dfe6b1c772dc588aa513
BLAKE2b-256 5561ee17552716d946d0e861a5f025d37e1c4a47fce4e3f1bc9bfffeaf3759f4

See more details on using hashes here.

Supported by

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