MCPcopy Create free account
hub / github.com/numpy/numpy / rec_append_fields

Function rec_append_fields

numpy/lib/recfunctions.py:730–761  ·  view source on GitHub ↗

Add new fields to an existing array. The names of the fields are given with the `names` arguments, the corresponding values with the `data` arguments. If a single field is appended, `names`, `data` and `dtypes` do not have to be lists but just values. Parameters ------

(base, names, data, dtypes=None)

Source from the content-addressed store, hash-verified

728
729@array_function_dispatch(_rec_append_fields_dispatcher)
730def rec_append_fields(base, names, data, dtypes=None):
731 """
732 Add new fields to an existing array.
733
734 The names of the fields are given with the `names` arguments,
735 the corresponding values with the `data` arguments.
736 If a single field is appended, `names`, `data` and `dtypes` do not have
737 to be lists but just values.
738
739 Parameters
740 ----------
741 base : array
742 Input array to extend.
743 names : string, sequence
744 String or sequence of strings corresponding to the names
745 of the new fields.
746 data : array or sequence of arrays
747 Array or sequence of arrays storing the fields to add to the base.
748 dtypes : sequence of datatypes, optional
749 Datatype or sequence of datatypes.
750 If None, the datatypes are estimated from the `data`.
751
752 See Also
753 --------
754 append_fields
755
756 Returns
757 -------
758 appended_array : np.recarray
759 """
760 return append_fields(base, names, data=data, dtypes=dtypes,
761 asrecarray=True, usemask=False)
762
763
764def _repack_fields_dispatcher(a, align=None, recurse=None):

Callers

nothing calls this directly

Calls 1

append_fieldsFunction · 0.85

Tested by

no test coverage detected