Skip to content
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

Regression 0.1.6 -> 0.1.7 for numpy arrays #56

Open
jtlz2 opened this issue Sep 27, 2019 · 2 comments
Open

Regression 0.1.6 -> 0.1.7 for numpy arrays #56

jtlz2 opened this issue Sep 27, 2019 · 2 comments

Comments

@jtlz2
Copy link

jtlz2 commented Sep 27, 2019

Such a useful module - thank you.

I've noticed that when a numpy array is present as a dictionary value, flatten() throws the following:

  File "myfile.py", line 452, in myfunc
    flattened = flatten(x)
  File "/anaconda2/lib/python2.7/site-packages/flatten_json.py", line 82, in flatten
    _flatten(nested_dict, None)
  File "/anaconda2/lib/python2.7/site-packages/flatten_json.py", line 74, in _flatten
    object_key))
  File "/anaconda2/lib/python2.7/site-packages/flatten_json.py", line 66, in _flatten
    if not object_:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

This worked in 0.1.6. Any ideas what happened? Has some default changed? Is there a workaround? Thanks

@jtlz2
Copy link
Author

jtlz2 commented Jan 23, 2020

Any update on this?

@amirziai
Copy link
Owner

@jtlz2 do you mind sharing an example? I haven't looked at it myself yet, maybe someone else has?!

We don't have any tests with numpy arrays and a recent change must've broken things.

@jtlz2 jtlz2 mentioned this issue Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants