code: def get_axis_bin_index(self, value, axis):
          
          axis = self.get_axis_number(axis)
          bin_edges = self.bin_edges[axis]
          # The right bin edge of np.histogram is inclusive:
          if value == bin_edges[-1]:
              # Minus two: one for bin edges rather than centers, one for 0-based indexing
              return len(bin_edges) - 2
          # For all other bins, it is exclusive.
          result = np.searchsorted(bin_edges, [value], side='right')[0] - 1
          if not 0 <= result <= len(bin_edges) - 1:
              raise CoordinateOutOfRangeException("Value %s is not in range (%s-%s) of axis %s" % (
                  value, bin_edges[0], bin_edges[-1], axis))
          return result
docs: Returns index along axis of bin in histogram which contains value
          Inclusive on both endpoints