MCPcopy Index your code
hub / github.com/numpy/numpy / _keep_fields

Function _keep_fields

numpy/lib/recfunctions.py:566–588  ·  view source on GitHub ↗

Return a new array keeping only the fields in `keep_names`, and preserving the order of those fields. Parameters ---------- base : array Input array keep_names : string or sequence String or sequence of strings corresponding to the names of the field

(base, keep_names, usemask=True, asrecarray=False)

Source from the content-addressed store, hash-verified

564
565
566def _keep_fields(base, keep_names, usemask=True, asrecarray=False):
567 """
568 Return a new array keeping only the fields in `keep_names`,
569 and preserving the order of those fields.
570
571 Parameters
572 ----------
573 base : array
574 Input array
575 keep_names : string or sequence
576 String or sequence of strings corresponding to the names of the
577 fields to keep. Order of the names will be preserved.
578 usemask : {False, True}, optional
579 Whether to return a masked array or not.
580 asrecarray : string or sequence, optional
581 Whether to return a recarray or a mrecarray (`asrecarray=True`) or
582 a plain ndarray or masked array with flexible dtype. The default
583 is False.
584 """
585 newdtype = [(n, base.dtype[n]) for n in keep_names]
586 output = np.empty(base.shape, dtype=newdtype)
587 output = recursive_fill_fields(base, output)
588 return _fix_output(output, usemask=usemask, asrecarray=asrecarray)
589
590
591def _rec_drop_fields_dispatcher(base, drop_names):

Callers 1

join_byFunction · 0.85

Calls 2

recursive_fill_fieldsFunction · 0.85
_fix_outputFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…