-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
json_normalize throws AttributeError
when calling with array of values
#21608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Does this throw an error when dealing with actual JSON objects instead of a list of integers? |
No. It does not throw if the array contains objects. |
I'm going to label this as an enhancement then as the documentation for json_normalize states it only works with JSON objects instead of just values. With that said, I'm -1 on this as I think it just becomes an alternate constructor for a DataFrame. I also don't think this would be supported by read_json (correct if wrong) so it becomes kind of a nuanced corner of our JSON IO ops. If we did want to do something like this, at the very least I think it should return a Series and not a DataFrame as AFAICT this will never be multi-dimensional (again correct if wrong). Curious what others think |
I'm not particularly against having "another constructor" for a cc @jreback |
so we accept a |
Agree with you guys. |
Uh oh!
There was an error while loading. Please reload this page.
Code Sample, a copy-pastable example if possible
xref #21605
Problem description
The above code throws
AttributeError
:Expected Output
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.4.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 62 Stepping 4, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
pandas: 0.23.1
pytest: 3.6.1
pip: 10.0.1
setuptools: 28.8.0
Cython: None
numpy: 1.14.2
scipy: None
pyarrow: None
xarray: None
IPython: 6.3.1
sphinx: None
patsy: None
dateutil: 2.7.2
pytz: 2018.4
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: 4.6.0
html5lib: 1.0.1
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: