Pandas read_json ValueError: Protocol not known

Viewed 15498

I ran the following code a while ago and it worked but now there is the following error. How to solve it?

ValueError: protocol not known.

import json
temp = json.dumps([status._json for status in tweet])  # create JSON
newdf = pd.read_json(temp, orient='records')
2 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.

Related