skip to navigation
skip to content

Not Logged In

pyjstat 0.1.4

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

Package Documentation

Latest Version: 0.1.8

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.

[1]http://json-stat.org/ for JSON-stat information
[2]http://pandas.pydata.org for Python Data Analysis Library information
[3]https://github.com/ajschumacher/rjstat for rjstat library information

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)
 
File Type Py Version Uploaded on Size
pyjstat-0.1.4.tar.gz (md5) Source 2014-05-25 153KB
  • Downloads (All Versions):
  • 18 downloads in the last day
  • 191 downloads in the last week
  • 612 downloads in the last month