-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
json_normalize in 1.0.0 with meta path specified - expects iterable #31507
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
Looks buggy - investigation and PRs would certainly be welcome! |
It looks like this may have been introduced with pull request #30145. |
are you into fixing it? @tturocy otherwise, i could take this one Before working on it, I would like to clarify the correct behaviour @WillAyd And IMO, there is sort of inconsistency now in behaviour, because if we do not specify anything, then that |
@charlesdong1991 keep in mind that json normalizing and json parsing are not the same. I think your question is if |
Ah, yeah, thanks for your quick reply @WillAyd , my doubt was indeed why both have to be |
Thank you for picking this up @charlesdong1991 ! |
I am having the same issue: |
@charlesdong1991 Any status on this issue? We've had to revert have to 0.25.3. Is there a workaround? |
I had the same issue, I added the code from @charlesdong1991 pull request and it is working for me |
thanks for all your comments!! The PR is underway, and the issue which causes this problem is for If it is big issue @sboagibm in your use case, as @keua said, use the current change in this PR could work around it or roll back to earlier version, and then wait for the new release. Thanks! |
Is this issue solved in which version of pandas? |
Still experiencing this issue, any way around? |
This looks fine to me in the latest version of pandas In [1]: import json
...: from pandas import json_normalize
...:
...: the_json = """
...: [{"id": 99,
...: "data": [{"one": 1, "two": 2}]
...: }]
...: """
...:
...: print(json_normalize(json.loads(the_json),
...: record_path=['data'], meta=['id']))
one two id
0 1 2 99 |
Code Sample, a copy-pastable example if possible
Problem description
Through 0.25.3, this program generates a DataFrame with one row. In 1.0.0 it fails with an exception:
I don't see any documentation changes that suggest a backwards-incompatible change. All my calls to
json_normalize
that don't usemeta
function as before.Expected Output
Through 0.25.3, the output was:
Output of
pd.show_versions()
From my virtualenv with pandas 1.0.0:
pandas : 1.0.0
numpy : 1.18.1
pytz : 2019.3
dateutil : 2.8.1
pip : 19.0.3
setuptools : 40.8.0
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.5.0
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : 7.11.1
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : 4.5.0
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pytest : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : 1.3.13
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
numba : None
From my virtualenv with 0.25.x:
pandas : 0.25.0
numpy : 1.18.1
pytz : 2019.3
dateutil : 2.8.1
pip : 19.0.3
setuptools : 40.8.0
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.4.1
html5lib : 1.0.1
pymysql : None
psycopg2 : None
jinja2 : None
IPython : 7.7.0
pandas_datareader: None
bs4 : 4.8.0
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : 4.4.1
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
s3fs : None
scipy : None
sqlalchemy : 1.3.7
tables : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
The text was updated successfully, but these errors were encountered: