bizarre Numeric error

Chris Fonnesbeck spam at
Sat Jun 21 00:56:39 CEST 2003

Something very wierd is going on with transpose in Numeric: I have an
empty list to which I am iteratively adding 2-element lists. In my
code, I transpose this array for use in other operations. Even though
my array is tranposeable, in my code, I get a TypeError. Here is the
chunk of code:

print obs
_X,_Y = t(obs)

here, I imported Numeric.transpose as t. Running the code gives:

[[0.5, 0.022628661753748849]]
Traceback (most recent call last):
  File "", line 268, in ?
  File "", line 258, in runTest
  File "", line 210, in filter
    _X,_Y = transpose(obs)
  File "/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/Numeric/",
line 248, in transpose
    return multiarray.transpose(a, axes)
TypeError: a float is required

The first line of the output is the list that I'm trying to transpose.
There is no reason I can see why this shouldnt work. If I do it by
hand in a python shell, it transposes fine:

>>> from Numeric import *
>>> a = [[0.5,0.022628661753748849]]
>>> transpose(a)
array([[ 0.5       ],
       [ 0.022628661753748849]])

I'm totally stumped. Pelase help.

More information about the Python-list mailing list