[Numpy-discussion] Converting a list

Nils Wagner nwagner at iam.uni-stuttgart.de
Mon Jul 10 05:26:57 EDT 2006


Hi all,

I have a list consisting of arrays of different size

data =  [array([-1.        +0.j, -1.33333333+0.j, -1.66666667+0.j]),
array([-2.+0.j        , -2.-0.66666667j, -2.-1.33333333j]),
array([-2.        -2.j, -1.33333333-2.j, -0.66666667-2.j]), array([
0.-2.j        ,  0.-1.66666667j,  0.-1.33333333j]), array([ 
6.12323400e-17-1.j        ,  -2.58819045e-01-0.96592583j,
        -5.00000000e-01-0.8660254j ,  -7.07106781e-01-0.70710678j,
        -8.66025404e-01-0.5j       ,  -9.65925826e-01-0.25881905j])]

type(data) =  <type 'list'>

shape(data) results in

shape(data) =
Traceback (most recent call last):
  File "sinai.py", line 107, in ?
    p = polygon(P)
  File "sinai.py", line 67, in polygon
    print 'shape(data) = ',shape(data)
  File "/usr/lib64/python2.4/site-packages/numpy/core/fromnumeric.py",
line 258, in shape
    result = asarray(a).shape
  File "/usr/lib64/python2.4/site-packages/numpy/core/numeric.py", line
119, in asarray
    return array(a, dtype, copy=False, order=order)
TypeError: a float is required

Is this a bug ?

Nils





More information about the NumPy-Discussion mailing list