Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pandas read json ValueError: Protocol not known

Tags:

python

pandas

I ran these codes a while ago and it worked but now there is a ValueError: protocol not known. Could anyone help. Thanks.

import json
temp = json.dumps([status._json for status in tweet]) #create JSON
newdf = pd.read_json(temp, orient='records')
like image 578
Jason Avatar asked Aug 24 '20 02:08

Jason


1 Answers

The solution in my case consisted in using StringIO as below:

from io import StringIO
newdf = pd.read_json(StringIO(temp))

Looks like pd.read_json in Pandas 1.1 is no more accepting simple string.

like image 92
ehabets Avatar answered Sep 23 '22 11:09

ehabets