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).
>>> 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'})
pip install jparse
or
pip install git+https://github.com/elisong/jparse.git#egg=jparse
- Change
JParser.to_df
by adding sort before to DataFrame
- Remove
collections.dafaultdict
from japrse.py
- Change
pd.DataFrame()
topd.DataFrame.from_records()
forJParser.to_df()
- Change assert_frame_equal import for tests/test_to_df.py
- Changed remove JParser.to_df() reset_index()
- Changed license.
- Added project.