一个类似json的python对象解析工具
jparse的Python项目详细描述
创建此工具是为了使从httpresponse.json()或json库json.loads()检索数据变得容易。 它有助于flatten、filter、select、update和sort这样的对象,最后是to_df(pandas.dataframe格式)。
简单情况
>>>fromjparseimportJParser>>>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
或
pip install git+https://github.com/elisong/jparse.git#egg=jparse
更改日志
V0.1.8-2018年8月18日
- changeJParser.to_dfby adding sort before to dataframe
V0.1.7-2018年8月18日
- removecollections.dafaultdictfrom japrse.py
v0.1.6-2018年8月18日
- 将JParser.to_df()的{tt11}$更改为pd.DataFrame.from_records()。
- changeassert_frame_equal import for tests/test_df.py
V0.1.5-2018年8月18日
- 已更改删除jparser.to_df()reset_index()
V0.1.4-2018年8月15日
- 已更改许可证。
V0.1.3-2018年8月13日
- 已添加项目。