[Numpy-discussion] Re: creating record arrays using memmap

JC Hsu hsu at stsci.edu
Mon Nov 17 20:25:02 CST 2003


Yes, it is possible to create a record array with memmap.  
The trick is to use the constructor, instead of the "array" 
function:  

>>> from numarray import memmap, records
>>> m=memmap.open('xxx.txt')
>>> r2=records.RecArray(m[0:18],formats='i2,f4',shape=3)

Notice that you also need to "calculate" the slice (you must 
use the slice even if you are mapping the whole file).

JC Hsu




More information about the Numpy-discussion mailing list