-
Notifications
You must be signed in to change notification settings - Fork 87
Closed
Description
dpath v2.0.1 (current pypi version) can't handle a dict with some numpy array further inside, even though I'm not dealing with the array directly.
Observed Behaviour
import numpy
import dpath.util
npa = numpy.array([42], dtype='uint64')
data = {'a': {'b': {'c': {'d': {'e': npa} }}}}
path = '/a/b/c'
dpath.util.get(data, path)
Yields:
[...]
File "/[...]/venv-dev/lib/python3.8/site-packages/dpath/segments.py", line 48, in walk
for k, v in kvs(obj):
File "/[...]/venv-dev/lib/python3.8/site-packages/dpath/segments.py", line 16, in kvs
return zip(range(len(node)), node)
TypeError: object of type 'numpy.uint64' has no len()
Expected Behaviour
Should yield:
{'d': {'e': array([42], dtype=uint64)}}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels