You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In[21]: pandas.io.json.json_normalize([])
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-21-1bd834af8a9b> in <module>()
----> 1 pandas.io.json.json_normalize([])
/usr/local/lib/python3.6/site-packages/pandas/io/json.py in json_normalize(data, record_path, meta, meta_prefix, record_prefix)
791792if record_path isNone:
--> 793 if any([isinstance(x, dict) for x in compat.itervalues(data[0])]):
794# naive normalization, this is idempotent for flat records795# and potentially will inflate the data considerably forIndexError: list index out of range
Problem description
This should probably return an empty dataframe when the list is empty, based on len(data) being 0.
Code Sample, a copy-pastable example if possible
Problem description
This should probably return an empty dataframe when the list is empty, based on
len(data)
being 0.Expected Output
Admittedly, this could be a series too -- I was using this across several collections and noticed I had to code around when some entries were empty.
Output of
pd.show_versions()
The text was updated successfully, but these errors were encountered: