code: def histogram(input, min, max, bins, labels=None, index=None):
      """
      Calculate the histogram of the values of an array, optionally at labels.
  
      Histogram calculates the frequency of values in an array within bins
      determined by `min`, `max`, and `bins`. The `labels` and `index`
      keywords can limit the scope of the histogram to specified sub-regions
      within the array.
  
      Parameters
      ----------
      input : array_like
          Data for which to calculate histogram.
      min, max : int
          Minimum and maximum values of range of histogram bins.
      bins : int
          Number of bins.
      labels : array_like, optional
          Labels for objects in `input`.
          If not None, must be same shape as `input`.
      index : int or sequence of ints, optional
          Label or labels for which to calculate histogram. If None, all values
          where label is greater than zero are used
  
      Returns
      -------
      hist : ndarray
          Histogram counts.
  
      Examples
      --------
      >>> a = np.array([[ 0.    ,  0.2146,  0.5962,  0.    ],
      ...               [ 0.    ,  0.7778,  0.    ,  0.    ],
      ...               [ 0.    ,  0.    ,  0.    ,  0.    ],
      ...               [ 0.    ,  0.    ,  0.7181,  0.2787],
      ...               [ 0.    ,  0.    ,  0.6573,  0.3094]])
      >>> from scipy import ndimage
      >>> ndimage.measurements.histogram(a, 0, 1, 10)
      array([13,  0,  2,  1,  0,  1,  1,  2,  0,  0])
  
      With labels and no indices, non-zero elements are counted:
  
      >>> lbl, nlbl = ndimage.label(a)
      >>> ndimage.measurements.histogram(a, 0, 1, 10, lbl)
      array([0, 0, 2, 1, 0, 1, 1, 2, 0, 0])
  
      Indices can be used to count only certain objects:
  
      >>> ndimage.measurements.histogram(a, 0, 1, 10, lbl, 2)
      array([0, 0, 1, 1, 0, 0, 1, 1, 0, 0])
  
      """
      _bins = numpy.linspace(min, max, bins + 1)
  
      def _hist(vals):
          return numpy.histogram(vals, _bins)[0]
  
      return labeled_comprehension(
          input,
          labels,
          index,
          _hist,
          object,
          None,
          pass_positions=False,
      )
  
imports: from __future__ import division, print_function, absolute_import
  import numpy
  import numpy
  from .None import _ni_support
  from .None import _ni_label
  from .None import _nd_image
  from .None import morphology
label_desc: Use image node_id 18 for calling a global function with example usage: histogram(input, min, max, bins, labels, index) and returns: labeled_comprehension, numpy