I made a 250MB json file that should look like this:
[ {"A":"uniquevalue0", "B":[1,2,3]},
{"A":"uniquevalue1", "B":[1]},
{"A":"uniquevalue2", "B":[1,2,3,4]} ]
where the "B" value can be variable len >= 1. This says I have valid JSON.
I call
df = pandas.read_json('ut1.json', orient = 'records', dtype={"A":str, "B":list})
Here is the documentation. When reading into a pandas dataframe, I get the following traceback:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/.../pandas/io/json.py", line 198, in read_json
date_unit).parse()
File "/.../pandas/io/json.py", line 266, in parse
self._parse_no_numpy()
File "/.../pandas/io/json.py", line 496, in _parse_no_numpy
loads(json, precise_float=self.precise_float), dtype=None)
ValueError: Unexpected character found when decoding 'true'
Can't think of what is going wrong. The python file that is throwing the error is not that helpful.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…