简体   繁体   English

使用Pandas读取Json文件

[英]read Json file using Pandas

I am trying to read a json file using pandas's read_json function and i am getting result but not what i want My result have first row as a header (Titles) and i want to ignore first row in my result. 我正在尝试使用pandas的read_json函数读取json文件,但得到的结果却不是我想要的结果。我的结果具有第一行作为标题(标题),并且我想忽略结果中的第一行。 Below is my python code. 以下是我的python代码。

import json
import pandas as pd
result=pd.read_json('dummy_DB_clean.json')
print result

I tried pandas's json_normalize() function but did not get desired output. 我尝试了熊猫的json_normalize()函数,但没有得到想要的输出。 If anyone of you , come across with this problem, please suggest me the solution. 如果您中有人遇到此问题,请向我提出解决方案。 Thanks, 谢谢,

Try this: 尝试这个:

import json
import pandas as pd
df=pd.read_json('dummy_DB_clean.json')
df.drop(df.head(1).index, inplace=True)
print df

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM