code: def numpy_binning(data, bins=10, range=None, *args, **kwargs) -> NumpyBinning:
      
      if isinstance(bins, int):
          if range:
              bins = np.linspace(range[0], range[1], bins + 1)
          else:
              start = data.min()
              stop = data.max()
              bins = np.linspace(start, stop, bins + 1)
      elif np.iterable(bins):
          bins = np.asarray(bins)
      else:
          # Some numpy edge case
          _, bins = np.histogram(data, bins, **kwargs)
      return NumpyBinning(bins)
docs: Construct binning schema compatible with numpy.histogram
  
      Parameters
      ----------
      data: array_like, optional
          This is optional if both bins and range are set
      bins: int or array_like
      range: Optional[tuple]
          (min, max)
      includes_right_edge: Optional[bool]
          default: True
  
      See Also
      --------
      numpy.histogram