[Numpy-discussion] Problems with list 2 array

Pepe Barbe elventear at gmail.com
Sun Jul 2 16:32:26 CDT 2006


I have some data I've generated and stored in a PyTables database.
Then I retrieve the data in a script and do some processing.

I have two different datasets that have been generated in the same
way, and one works perfectly as intended while the other gives me an
error. I'll explain in the following lines what happens.

The information in question is stored in a list that contains 10 one
dimensional arrays. The data is stored in a variable called prob. If I
execute array(prob) on the data coming of one of the sources it is
converted in a 10xn numpy array. If I do the same thing on the other I
get the following:

In [56]: array(prob)
exceptions.TypeError                                 Traceback (most
recent call last)

/Users/elventear/Projects/workspace/libSVM Scripts/src/<ipython console>

TypeError: a float is required

I have no idea why it is complaining about this. I've compared the
data coming from the two sources and they seem the same. In both
cases, they are like this:

In [57]: type(prob)
Out[57]: <type 'list'>

In [58]: type(prob[0])
Out[58]: <type 'numpy.ndarray'>

In [59]: type(prob[0][0])
Out[59]: <type 'float64scalar'>

I have no idea where else to look to solve this problem. As I said the
data is generated identically starting from two different data sources
and then processed identically with the same script. From one data
source it just works while the other complains.


More information about the Numpy-discussion mailing list