You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
>>> a = np.array([np.array([1, 2]), np.array(1)])
>>> a
array([array([1, 2]), array(1)], dtype=object)
>>> b = np.array([np.array(1), np.array([1, 2])])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: setting an array element with a sequence.
Specifying dtype avoids the exception for b:
>>> b = np.array([np.array(1), np.array([1, 2])], dtype=object)
>>> b
array([array(1), array([1, 2])], dtype=object)
However dtype is optional. If an array can be instantiated successfully without dtype for a given input sequence, then re-ordering the sequence should not cause an exception.
python 3.4.5 numpy 1.13.1.
The text was updated successfully, but these errors were encountered:
We're definitely aware of this, and there's an issue somewhere suggesting that we change this behavior so that passing dtype=object is always required, and that otherwise both cases should error.
Uh oh!
There was an error while loading. Please reload this page.
For example:
Specifying dtype avoids the exception for b:
However dtype is optional. If an array can be instantiated successfully without dtype for a given input sequence, then re-ordering the sequence should not cause an exception.
python 3.4.5 numpy 1.13.1.
The text was updated successfully, but these errors were encountered: