BUG: json_normalize fails with empty arrays/lists #47182
Labels
Bug
IO JSON
read_json, to_json, json_normalize
Nested Data
Data where the values are collections (lists, sets, dicts, objects, etc.).
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
when normalizing nested lists, which are empty in all the objects, json_normalize fails with "ValueError: operands could not be broadcast together with shape".
It may be related to the behavior of np.repeat(), but I report the issue to pandas, because it looks like an overlooked corner case:
and
Expected Behavior
Return correct data structure and not fail.
Installed Versions
INSTALLED VERSIONS
commit : 4bfe3d0
python : 3.10.2.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19044
machine : AMD64
processor : Intel64 Family 6 Model 141 Stepping 1, GenuineIntel
byteorder : little
LC_ALL : en_US.UTF-8
LANG : en_US.UTF-8
The text was updated successfully, but these errors were encountered: