class format_parser:
Class to convert formats, names, titles description to a dtype.
After constructing the format_parser object, the dtype attribute is the converted data-type: dtype = format_parser(formats, names, titles).dtype
dtype.newbyteorder
.dtype, typename, sctype2char
>>> np.format_parser(['<f8', '<i4', '<a5'], ['col1', 'col2', 'col3'], ... ['T1', 'T2', 'T3']).dtype dtype([(('T1', 'col1'), '<f8'), (('T2', 'col2'), '<i4'), (('T3', 'col3'), 'S5')])
names
and/or titles
can be empty lists. If titles
is an empty list,
titles will simply not appear. If names
is empty, default field names
will be used.
>>> np.format_parser(['f8', 'i4', 'a5'], ['col1', 'col2', 'col3'], ... []).dtype dtype([('col1', '<f8'), ('col2', '<i4'), ('col3', '<S5')]) >>> np.format_parser(['<f8', '<i4', '<a5'], [], []).dtype dtype([('f0', '<f8'), ('f1', '<i4'), ('f2', 'S5')])
Method | __init__ |
Undocumented |
Method | _createdtype |
Undocumented |
Method | _parseFormats |
Parse the field formats |
Method | _setfieldnames |
convert input field names into a list and assign to the _names attribute |
Instance Variable | _f_formats |
Undocumented |
Instance Variable | _names |
Undocumented |
Instance Variable | _nfields |
Undocumented |
Instance Variable | _offsets |
Undocumented |
Instance Variable | _titles |
Undocumented |
Instance Variable | dtype |
Undocumented |