General utility functions¶
-
sciutils.util.
bincountnd
(xs, weights=None, minshape=None)¶ Count number of occurrences of each value in an array of non-negative integer tuples.
- Parameters
xs (array_like, 2 dimensions, non-negative integers) – Input array with shape (p, n), where p is the number of dimensions of the output array and n is the number of indices.
weights (array_like, 1 dimension, optional) – Weight vector of length n corresponding to indices in xs.
minshape (tuple, optional) – A minimum shape for the output array.
- Returns
out – The result of binning the input indices.
- Return type
ndarray
-
sciutils.util.
dict_list_transpose
(xs)¶ Transpose a dictionary of arrays to an array of dictionaries and vice versa.
- Parameters
xs (mapping or iterable) – Dictionary of arrays or array of dictionaries to convert.
- Returns
y – Transposed dictionary of arrays or array of dictionaries to convert.
- Return type
iterable or mapping