numpy.ma..mrecords
Defines the equivalent of numpy.recarrays
for masked arrays,
where fields can be accessed as attributes.
Note that numpy.ma.MaskedArray
already supports structured datatypes
and the masking of individual fields.
Class |
|
No summary |
Function | addfield |
Adds a new field to the masked record array |
Function | fromarrays |
Creates a mrecarray from a (flat) list of masked arrays. |
Function | fromrecords |
Creates a MaskedRecords from a list of records. |
Function | fromtextfile |
Creates a mrecarray from data stored in the file filename . |
Function | openfile |
Opens the file handle of file fname . |
Variable | reserved |
Undocumented |
Function | _checknames |
Checks that field names descr are not reserved keywords. |
Function | _get |
Undocumented |
Function | _guessvartypes |
Tries to guess the dtypes of the str_ ndarray arr . |
Function | _mrreconstruct |
Build a new MaskedArray from the information stored in a pickle. |
Adds a new field to the masked record array
Uses newfield
as data and newfieldname
as name. If newfieldname
is None, the new field name is set to 'fi', where i
is the number of
existing fields.
Creates a mrecarray from a (flat) list of masked arrays.
Notes
Lists of tuples should be preferred over lists of lists for faster processing.
Parameters | |
arraylist:sequence | A list of (masked) arrays. Each element of the sequence is first converted to a masked array if needed. If a 2D array is passed as argument, it is processed line by line |
dtype:{None, dtype}, optional | Data type descriptor. |
shape:{None, integer}, optional | Number of records. If None, shape is defined from the shape of the first array in the list. |
formats:{None, sequence}, optional | Sequence of formats for each individual field. If None, the formats will be autodetected by inspecting the fields and selecting the highest dtype possible. |
names:{None, sequence}, optional | Sequence of the names of each field. |
titles | Undocumented |
aligned | Undocumented |
byteorder | Undocumented |
fill | Sequence of data to be used as filling values. |
Creates a MaskedRecords from a list of records.
Notes
Lists of tuples should be preferred over lists of lists for faster processing.
Parameters | |
reclist:sequence | A list of records. Each element of the sequence is first converted to a masked array if needed. If a 2D array is passed as argument, it is processed line by line |
dtype:{None, dtype}, optional | Data type descriptor. |
shape:{None, int}, optional | Number of records. If None, shape is defined from the shape of the first array in the list. |
formats:{None, sequence}, optional | Sequence of formats for each individual field. If None, the formats will be autodetected by inspecting the fields and selecting the highest dtype possible. |
names:{None, sequence}, optional | Sequence of the names of each field. |
titles | Undocumented |
aligned | Undocumented |
byteorder | Undocumented |
fill | Sequence of data to be used as filling values. |
mask:{nomask, sequence}, optional. | External mask to apply on the data. |
Creates a mrecarray from data stored in the file filename
.
Ultra simple: the varnames are in the header, one line
Parameters | |
fname:{file name/handle} | Handle of an opened file. |
delimiter:{None, string}, optional | Alphanumeric character used to separate columns in the file. If None, any (group of) white spacestring(s) will be used. |
commentchar:{'#', string}, optional | Alphanumeric character used to mark the start of a comment. |
missingchar:{'', string}, optional | String indicating missing data, and used to create the masks. |
varnames:{None, sequence}, optional | Sequence of the variable names. If None, a list will be created from the first non empty line of the file. |
vartypes:{None, sequence}, optional | Sequence of the variables dtypes. If None, it will be estimated from the first non-commented line. |
delimitor | Undocumented |
Checks that field names descr are not reserved keywords.
If this is the case, a default 'f%i' is substituted. If the argument
names
is not None, updates the field names to valid names.