Closed
Description
Reproducing code example:
import numpy as np
np.asarray(["a",("b","c")])
Error message:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/numpy/core/numeric.py", line 531, in asarray
return array(a, dtype, copy=False, order=order)
ValueError: cannot set an array element with a sequence
Note that
np.asarray([("b","c"),"a"])
works fine and gives
array([('b', 'c'), 'a'], dtype=object)
In addition,
np.asarray(["a",("b","c")], dtype="object")
also works and gives
array(['a', ('b', 'c')], dtype=object)
Numpy/Python version information:
('1.12.1', '2.7.13 (default, Nov 24 2017, 17:33:09) \n[GCC 6.3.0 20170516]')
Metadata
Metadata
Assignees
Labels
No labels