Les Schaffer wrote:
> 4. last year i made a case for the old records to return a list of the
> column names. it looks like the column names are now attributes of the
> record object, any chance of getting a list of them
> recarrayObj.get_colNames() or some such? yes, in working code, we know
> what the names are, but in test code we are creating recarrays from
> parsing of Excel spreadsheets, and for testing purposes, its nice to
> know what records THINKS are the names of all the columns.
In [2]: from numpy import *
In [3]: rec.fromarrays(ones(10, dtype=float)
Display all 628 possibilities? (y or n)
In [3]: a = rec.fromarrays([ones(10, dtype=float), ones(10, dtype=int)],
names='float,int', formats=[float, int])
In [4]: a
Out[4]:
recarray([(1.0, 1), (1.0, 1), (1.0, 1), (1.0, 1), (1.0, 1), (1.0, 1),
(1.0, 1), (1.0, 1), (1.0, 1), (1.0, 1)],
dtype=[('float', '>f8'), ('int', '>i4')])
In [6]: a.dtype.names
Out[6]: ('float', 'int')
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Numpy-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/numpy-discussion