matscipy.numpy_tricks

Functions

mabincount(x, weights, minlength[, axis])

Multi-axis bin count.

matscipy.numpy_tricks.mabincount(x, weights, minlength, axis=0)

Multi-axis bin count. Executes a bin count online a long a specific axis. (numpy.bincount only works on flattened arrays.)

Parameters:
  • x (array_like) – Array containing bin indices.

  • weights (array_like) – Weights to be binned, dimension axis must have same size as x.

  • minlength (int) – A minimum number of bins for the output array.

  • axis (int, optional) – Axis along which the bin counting is performed. (Default: 0)

Returns:

out – Array containing the counted data. Array has same dimensions as weights, with the exception of dimension axis that has is of at least minlength length.

Return type:

np.ndarray