2009/3/25 Jesper Larsen :
> import numpy as npy
> a = npy.empty((2), dtype=npy.object_)
>
> # Works fine:
> for i in range(len(a)):
> a[i] = []
> print a
>
> # Does not work:
> a[:] = []
> a[:] = list()
Slightly simpler would be:
In [26]: x = np.empty((2,), dtype=object)
In [27]: x[:] = [[] * le
Wed, 25 Mar 2009 12:04:43 +0100, Jesper Larsen wrote:
> I have a problem with array broadcasting for object arrays and list. I
> would like to create a numpy array containing empty lists (initially - I
> will append to them later):
[clip]
> Is it possible to broadcast a list to all elements of a nu
Hi numpy people,
I have a problem with array broadcasting for object arrays and list. I
would like to create a numpy array containing empty lists (initially -
I will append to them later):
import numpy as npy
a = npy.empty((2), dtype=npy.object_)
# Works fine:
for i in range(len(a)):
a[i] = []