code: def count(self, data):
          
          if isinstance(data, float) or isinstance(data, int):
              hist = numpy.zeros(self.nbin + 2, float)
              if data > self.bins[-1]:
                  hist[-1] = 1.
              elif data < self.bins[0]:
                  hist[0] = 1.
              elif data == self.bins[-1]:
                  if self.nbin > 1:
                      hist[-2] = 1.
              else:
                  hist[numpy.searchsorted(self.bins, data, side='right')] = 1.
              return hist
          if numpy.ndim(data) != 1:
              data = numpy.reshape(data, -1)
          else:
              data = numpy.asarray(data)
          middle = numpy.histogram(data, self.bins)[0]
          below = numpy.sum(data < self.bins[0])
          above = numpy.sum(data > self.bins[-1])
          return numpy.array([below] + middle.tolist() + [above], float)
docs: Compute histogram of data.
  
          Counts the number of elements from array ``data`` in each bin of the
          histogram. Results are returned in an array, call it ``h``, of
          length ``nbin+2`` where ``h[0]`` is the number of data elements
          that fall below the range of the histogram, ``h[-1]``
          (i.e., ``h[nbin+1]``) is the number that fall above the range,
          and ``h[i]`` is the number in the ``i``-th bin for ``i=1...nbin``.
  
          Argument ``data`` can also be a float, in which case the result is the
          same as from ``histogram([data])``. Note that the expectation value of
          ``count(f(p))`` over parameter values ``p`` drawn from a random
          distribution gives the probabilities for values of ``f(p)`` to fall
          in each histogram bin. Dividing  by the bin widths gives the average
          probability density for random variable ``f(p)`` in each bin.
  
          Bin intervals are closed on the left and open on the right,
          except for the last interval which is closed on both ends.