A JSON-like object parsing tool for python
Project description
This tool is created to make retrieving data from http response.json() or json library json.loads() easy. It helps to flatten, filter, select, update, and sort such objects, finally to_df (pandas.DataFrame format).
Simple Case
>>> from jparse import JParser
>>> jp = JParser()
>>> TEST_CASE1 = [{'A1': 1, 'A2': 2, 'A3': 3},
{'A1': [4, 5, 6], 'A2': 7, 'A3': 'x'}]
>>> print(jp.flatten(TEST_CASE1))
defaultdict(None, {'0_A1': 1,
'0_A2': 2,
'0_A3': 3,
'1_A1_0': 4,
'1_A1_1': 5,
'1_A1_2': 6,
'1_A2': 7,
'1_A3': 'x'})
Dependencies
Installation
pip install jparse
or
pip install git+https://github.com/elisong/jparse.git#egg=jparse
Document
Changelog
v0.1.8 - 2018-08-18
Change JParser.to_df by adding sort before to DataFrame
v0.1.7 - 2018-08-18
Remove collections.dafaultdict from japrse.py
v0.1.6 - 2018-08-18
Change pd.DataFrame() to pd.DataFrame.from_records() for JParser.to_df()
Change assert_frame_equal import for tests/test_to_df.py
v0.1.5 - 2018-08-18
Changed remove JParser.to_df() reset_index()
v0.1.4 - 2018-08-15
Changed license.
v0.1.3 - 2018-08-13
Added project.
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
Built Distribution
File details
Details for the file jparse-0.1.8.tar.gz
.
File metadata
- Download URL: jparse-0.1.8.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c778865578a8c766571abcf811840e818008d3a4a1311e7c918248e8a247dea5 |
|
MD5 | 02bdb45c074f5cc090d6cb6dbf9b0917 |
|
BLAKE2b-256 | 10e44769da08be65e7a114fd72b9a0573c64652098cd023289c2c5194d637a0c |
File details
Details for the file jparse-0.1.8-py2.py3-none-any.whl
.
File metadata
- Download URL: jparse-0.1.8-py2.py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9131d0f5872a1442e9f27916ead6b906df76281433d9dd5d3e3b6209783f99c |
|
MD5 | 749b3c1cbf9778a4c5c1ea76927b7a42 |
|
BLAKE2b-256 | bd8becd208fb15eac70c17b5526772703dd7c0b316b93454e192e6a47c340d34 |