blaze / blaze/odo

Bug in convert.py::list_to_numpy

Open
#387 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1k
Forks
131
PR merge metrics
No merged PRs in 30d

Description

``` python
from odo.convert import list_to_numpy
from odo import dshape

def test_list_to_numpy():
dshp = dshape('11 * {x: {a: int64, b: int64}, y: float64}')
d = [({'a': 1, 'b': 2}, 1.0),
({'a': 2, 'b': 3}, 2.0),
({'a': 3, 'b': 4}, 3.0)]
list_to_numpy(d, dshp)
```

output

```
=================================== FAILURES ===================================
______________________________ test_list_to_numpy ______________________________

def test_list_to_numpy():
dshp = dshape('11 * {x: {a: int64, b: int64}, y: float64}')
d = [({'a': 1, 'b': 2}, 1.0),
({'a': 2, 'b': 3}, 2.0),
({'a': 3, 'b': 4}, 3.0)]
> list_to_numpy(d, dshp)

test_foo.py:9:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

seq = [({'a': 1, 'b': 2}, 1.0), ({'a': 2, 'b': 3}, 2.0), ({'a': 3, 'b': 4}, 3.0)]
dshape = dshape("11 * {x: {a: int64, b: int64}, y: float64}"), kwargs = {}

@convert.register(np.ndarray, list, cost=10.0)
def list_to_numpy(seq, dshape=None, **kwargs):
if isinstance(element_of(seq), dict):
seq = list(records_to_tuples(dshape, seq))
if (seq and isinstance(seq[0], Iterable) and not ishashable(seq[0]) and
not isscalar(dshape)):
seq = list(map(tuple, seq))
> return np.array(seq, dtype=dshape_to_numpy(dshape))
E TypeError: a bytes-like object is required, not 'dict'
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.