code: def apply_along_fields(func, arr):
      """
      Apply function 'func' as a reduction across fields of a structured array.
  
      This is similar to `apply_along_axis`, but treats the fields of a
      structured array as an extra axis. The fields are all first cast to a
      common type following the type-promotion rules from `numpy.result_type`
      applied to the field's dtypes.
  
      Parameters
      ----------
      func : function
         Function to apply on the "field" dimension. This function must
         support an `axis` argument, like np.mean, np.sum, etc.
      arr : ndarray
         Structured array for which to apply func.
  
      Returns
      -------
      out : ndarray
         Result of the recution operation
  
      Examples
      --------
  
      >>> from numpy.lib import recfunctions as rfn
      >>> b = np.array([(1, 2, 5), (4, 5, 7), (7, 8 ,11), (10, 11, 12)],
      ...              dtype=[('x', 'i4'), ('y', 'f4'), ('z', 'f8')])
      >>> rfn.apply_along_fields(np.mean, b)
      array([ 2.66666667,  5.33333333,  8.66666667, 11.        ])
      >>> rfn.apply_along_fields(np.mean, b[['x', 'z']])
      array([ 3. ,  5.5,  9. , 11. ])
  
      """
      if arr.dtype.names is None:
          raise ValueError("arr must be a structured array")
  
      uarr = structured_to_unstructured(arr)
      return func(uarr, axis=-1)
  
imports: from __future__ import division, absolute_import, print_function
  import sys
  import itertools
  import numpy
  import numpy.ma
  from numpy import ndarray, recarray
  from numpy.ma import MaskedArray
  from numpy.ma.mrecords import MaskedRecords
  from numpy.core.overrides import array_function_dispatch
  from numpy.lib._iotools import _is_string_like
  from numpy.compat import basestring
  from numpy.testing import suppress_warnings
label_desc: Use image node_id 36 for calling a global function with example usage: apply_along_fields(func, arr) and returns: func