hp1232
hp1232

Reputation: 23

Pandas read_json value_error, Type_erroe

url = 'https://api.misoenergy.org/MISORTWDDataBroker/DataBrokerServices.asmx?messageType=getace&returnType=json'

pd.read_json(url)

ValueError: Expected object or value

pd.read_json(url, lines= True)

TypeError: initial_value must be str or None, not bytes

json sample:

{"MktDay":"11-19-2020","RefId":"19-Nov-2020 - Interval 14:10:00 EST","ACE":[{"instantEST":"2020-11-19 12:10:30 PM","value":"-60.95"},{"instantEST":"2020-11-19 12:11:00 PM","value":"172.85"},{"instantEST":"2020-11-19 12:11:30 PM","value":"344.70"}

Upvotes: 0

Views: 67

Answers (1)

Jonathan Leon
Jonathan Leon

Reputation: 5648

Both of your examples worked for me.

you can try this as an option:

import requests
data = requests.get('https://api.misoenergy.org/MISORTWDDataBroker/DataBrokerServices.asmx?messageType=getace&returnType=json')
pd.read_json(data.text)

Upvotes: 1

Related Questions