From: Ivan V. i B. <iv...@ca...> - 2007-11-28 11:36:23
|
Vince Fulco (el 2007-11-25 a les 23:28:19 -0500) va dir:: >[...] > Essentially I am taking a CSV file, converting the lines to numpy > arrays and loading them into tables. Upon running a query, I retrieve > the coordinates so I can then increment the rows forward by 1 and 2 > periods and collect the observations. However I am left with an > ndarray with each line type as numpy void. Running calculations on > this type, (i.e. cumsum by row) causes an error "cannot perform > accumulate with flexible type". >[...] I'm not quite sure of having understood the problem, but please note that ``read*()``ing from a table results in a NumPy record array, i.e. an array where rows are of an heterogeneous, compound type (void type in NumPy parlance). Even if your table only has one column, you will get an array of this kind. If you want to retrieve a single column from a ``read*()`` operation, you may a. pass the name of the column as the ``field`` argument to the method, or b. given the resulting NumPy array ``arr``, use ``arr['colname']``. But remember, tables *always have a compound type*. Did I get the problem (and the solution) right? ;) :: Ivan Vilata i Balaguer >qo< http://www.carabos.com/ C=E1rabos Coop. V. V V Enjoy Data "" |