ValueError: arrays must all be same length
On Fri, 2 Oct 2020 13:34:46 +0100, Shaozhong SHI <shishaozhong at gmail.com> wrote:
> I got a json response from an API and tried to use pandas to put data into
> a dataframe.
> However, I kept getting this ValueError: arrays must all be same length.
> Can anyone help?
> The following is the json text. Regards, Shao
> "locationId": "1-1004508435",
> "providerId": "1-101641521",
[huge block removed]
> "reportType": "Location"
> In [ ]:
> In :
> import pandas as pd
> import json
> j = json.JSONDecoder().decode(req.text) ###req.json
> df = pd.DataFrame.from_dict(j)
An important programming skill is paring back failing code to
create the smallest example that exhibits the failure. Often, the
paring process reveals the problem; and if it doesn't, the shorter
code is more likely to attract help.
To email me, substitute nowhere->runbox, invalid->com.