Category : Recommended   Active   

Description: NumPy structured array utilities

Within NumPy  there is a useful module numpy.lib.recfunctions for manipulating structured arrays.  At this time there does not seem to be any corresponding web documentation on the NumPy site, but there is available docstring help.  Within IPython you can do:
import numpy.lib.recfunctions
help numpy.lib.recfunctions

For reference the function definitions are shown below.  This module is available in NumPy versions 1.5 and 1.6 at least, other versions have not been checked.

NAME
numpy.lib.recfunctions - Collection of utilities to manipulate structured arrays.

DESCRIPTION
Most of these functions were initially implemented by John Hunter for matplotlib.
They have been rewritten and extended for convenience.

FUNCTIONS
append_fields(base, names, data=None, dtypes=None, fill_value=-1, usemask=True,
              asrecarray=False)
    Add new fields to an existing array.

drop_fields(base, drop_names, usemask=True, asrecarray=False)
    Return a new array with fields in `drop_names` dropped.
          dtype=[('a', '<i4')])

find_duplicates(a, key=None, ignoremask=True, return_index=False)
    Find the duplicates in a structured array along a given key
   
get_fieldstructure(adtype, lastname=None, parents=None)
    Returns a dictionary with fields as keys and a list of parent fields as values.
    This function is used to simplify access to fields nested in other fields.

join_by(key, r1, r2, jointype='inner', r1postfix='1', r2postfix='2',
        defaults=None, usemask=True, asrecarray=False)
    Join arrays `r1` and `r2` on key `key`.
   
merge_arrays(seqarrays, fill_value=-1, flatten=False, usemask=False, asrecarray=False)
    Merge arrays field by field.
   
rec_append_fields(base, names, data, dtypes=None)
    Add new fields to an existing array.

rec_drop_fields(base, drop_names)
    Returns a new numpy.recarray with fields in `drop_names` dropped.

rec_join(key, r1, r2, jointype='inner', r1postfix='1', r2postfix='2', defaults=None)
    Join arrays `r1` and `r2` on keys.
    Alternative to join_by, that always returns a np.recarray.

recursive_fill_fields(input, output)
    Fills fields from output with fields from input,
    with support for nested structures.

rename_fields(base, namemapper)
    Rename the fields from a flexible-datatype ndarray or recarray.
   
stack_arrays(arrays, defaults=None, usemask=True, asrecarray=False, autoconvert=False)
    Superposes arrays fields by fields



    7           11