[Numpy-discussion] Can't assign sequence to PyObject array

Stuart I Reynolds S.I.Reynolds at cs.bham.ac.uk
Sat Apr 28 09:59:46 EDT 2001


Actually your example works for me too. Looks like only it only works for
1D arrays,


>>> a1 = array([range(5), range(5)]).astype('O')
>>> a1
array([[0 , 1 , 2 , 3 , 4 ],
       [0 , 1 , 2 , 3 , 4 ]],'O')
>>> a2 = arange(6)
>>> a2
array([0, 1, 2, 3, 4, 5])
>>> a1[1,1] = a2
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ValueError: array too large for destination
>>> a1 = arange(5).astype('O')
>>> a1[1] = a2
>>> a1
array([0 , [0 1 2 3 4 5] , 2 , 3 , 4 ],'O')


Hmm. This looks like a bug then. I'll submit a bug report.

Cheers,
Stuart

On Thu, 19 Apr 2001, Pete Shinners wrote:

> shoot, sorry then, i just tested it and it seemed happy, let me
> try again here...
>
> >>> a1 = arange(5).astype('O')
> >>> a2 = arange(5,9)
> >>> a1
> array([0 , 1 , 2 , 3 , 4 ],'O')
> >>> a2
> array([5, 6, 7, 8])





More information about the NumPy-Discussion mailing list