将奇怪的json文件读入熊猫

时间:2019-09-26 08:19:15

标签: python json pandas

我有多个json文件:

data_part1.json
data_part2.json
data_part3.json
...

它们是这样写的:

{"transaction_id":203019326,"amount":2.4,"user_invoice_date":"2018-11-19"}
{"transaction_id":261491169,"amount":2.4,"user_invoice_date":"2019-02-20"}
{"transaction_id":294748592,"amount":2.4,"user_invoice_date":"2019-03-30"}

我已经尝试读取第一个文件:

openfile=open('path')                          
jsondata=json.load(openfile)
df=pd.DataFrame(jsondata)

openfile.close()

但是出现以下错误: JSONDecodeError: Expecting ',' delimiter: line 2 column 1 (char 77)

如何将这些文件读入数据框?

0 个答案:

没有答案