Parse error - Python API


Hello, I am working with API data, and following your instructions for Python. It work well for a while but then I ran the program again (with no changes in the code) and an “ValueError” appeared.

This step:

#Parse JSON to get a pandas.DataFrame
df = pd.read_json(r.text, orient= ‘index’)

and this response

ValueError Traceback (most recent call last)
in ()
1 #Parse JSON to get a pandas.DataFrame
----> 2 df = pd.read_json(r.text, orient= ‘index’)

/Users/priscilacastillocazares/anaconda/lib/python3.6/site-packages/pandas/io/json/ in read_json(path_or_buf, orient, typ, dtype, convert_axes, convert_dates, keep_default_dates, numpy, precise_float, date_unit, encoding, lines)
352 obj = FrameParser(json, orient, dtype, convert_axes, convert_dates,
353 keep_default_dates, numpy, precise_float,
–> 354 date_unit).parse()
356 if typ == ‘series’ or obj is None:

/Users/priscilacastillocazares/anaconda/lib/python3.6/site-packages/pandas/io/json/ in parse(self)
421 else:
–> 422 self._parse_no_numpy()
424 if self.obj is None:

/Users/priscilacastillocazares/anaconda/lib/python3.6/site-packages/pandas/io/json/ in _parse_no_numpy(self)
647 elif orient == “index”:
648 self.obj = DataFrame(
–> 649 loads(json, precise_float=self.precise_float), dtype=None).T
650 else:
651 self.obj = DataFrame(

ValueError: Expected object or value

Do you know what happened? and what can I do to make it work again?