# spacepy.toolbox.arraybin

`spacepy.toolbox.``arraybin`(array, bins)

  Split a sequence into subsequences based on value.

  Given a sequence of values and a sequence of values representing the division between bins, return the indices grouped by bin.

  Parameters: | array : array_like the input sequence to slice, must be sorted in ascending order bins : array_like dividing lines between bins. Number of bins is len(bins)+1, value that exactly equal a dividing value are assigned to the higher bin
  Returns: | out : list indices for each bin (list of lists)

  Examples

      >>> import spacepy.toolbox as tb
      >>> tb.arraybin(range(10), [4.2])
      [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]]