Version 1.0b1 API Documentation generated by Endo 2006-08-14
numfmt = nt.typeDict
Find duplication in a list, return a list of duplicated elements
create a record array from a (flat) list of arrays
>>> x1=array([1,2,3,4]) >>> x2=array(['a','dd','xyz','12']) >>> x3=array([1.1,2,3,4]) >>> r=fromarrays([x1,x2,x3],names='a,b,c') >>> print r[1] (2, 'dd', 2.0) >>> x1[1]=34 >>> r.a array([1, 2, 3, 4])
Create an array from binary file data
If file is a string then that file is opened, else it is assumed to be a file object.
>>> import testdata, sys >>> fd=open(testdata.filename) >>> fd.seek(2880*2) >>> r=fromfile(fd, formats='f8,i4,a5', shape=3, byteorder='big') >>> print r[0] (5.1000000000000005, 61, 'abcde') >>> r._shape (3,)
create a recarray from a list of records in text form
The data in the same field can be heterogeneous, they will be promoted to the highest data type. This method is intended for creating smaller record arrays. If used to create large array without formats defined
r=fromrecords([(2,3.,'abc')]*100000)
it can be slow.
If formats is None, then this will auto-detect formats. Use list of tuples rather than list of lists for faster processing.
>>> r=fromrecords([(456,'dbe',1.2),(2,'de',1.3)],names='col1,col2,col3') >>> print r[0] (456, 'dbe', 1.2) >>> r.col1 array([456, 2]) >>> r.col2 chararray(['dbe', 'de']) >>> import cPickle >>> print cPickle.loads(cPickle.dumps(r)) recarray[ (456, 'dbe', 1.2), (2, 'de', 1.3) ]
create a (read-only) record array from binary data contained in a string
| Local name | Refers to |
|---|---|
| chararray | numpy.core.defchararray.chararray |
| nt | numpy.core.numerictypes |
| os | os |
| sb | numpy.core.numeric |
| stat | stat |
| types | types |