Dumps and loads numpy-arrays into or from json
Project description
Transparent dumps and loads of numpy-arrays. If a list is loaded from a json string it is given to numpy.array(). If further, the resulting array has a primitive type of either (int, float) it is returned by loads.
install
pip install json-numpy-sebastian-achim-mueller
Encoder
to dump with json.dumps().
object_hook
to load with json.loads().
example
import numpy
import json_numpy
obj = json_numpy.loads(s='{"a": [1.0, NaN]}')
assert isinstance(obj["a"], numpy.ndarray)
json_numpy.dumps(obj)
'{"a": [1.0, NaN]}'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for json_numpy_sebastian_achim_mueller-0.1.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4dc975220a844b3776e6fab8e073ff62965f99b4605a1767eff4a3284230d7e1 |
|
MD5 | 10fa5bc2d2cf3ef7a556517aa4b13161 |
|
BLAKE2b-256 | 74a03ffa7d94c6bcbad45de38188e0aea39f2d4e76855f707ec37aa9adc2039c |
Close
Hashes for json_numpy_sebastian_achim_mueller-0.1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30f95088559dd02dd7da949d50d94083baf613572b987372b0b76c5f7eb96227 |
|
MD5 | 9aa0d26321c6ab93539fa8605fbb168d |
|
BLAKE2b-256 | 992efaee3862a75de7b52be3de2fc2dd35c6272cd8edf0ab42b19bbb93d8fa1f |