- array(obj, formats = None, names = None, titles = None, shape = None, byteorder = None, aligned = 0, offset = 0, strides = None)
- find_duplicate(list)
Find duplication in a list, return a list of duplicated elements
- fromarrays(arrayList, formats = None, names = None, titles = None, shape = None, aligned = 0)
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])
- fromfile(fd, formats, shape = None, names = None, titles = None, byteorder = None, aligned = 0, offset = 0)
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,)
- fromrecords(recList, formats = None, names = None, titles = None, shape = None, aligned = 0)
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)
]
- fromstring(datastring, formats, shape = None, names = None, titles = None, byteorder = None, aligned = 0, offset = 0)
create a (read-only) record array from binary data contained in
a string