Array

numpy_sugar._array.is_all_equal(arr)[source]

Check if the array values are all equal.

Parameters:arr (array_like) – sequence of values.
Returns:True if values are all equal.
Return type:bool
numpy_sugar._array.is_all_finite(arr)[source]

Check if the array values are all finite.

Parameters:arr (array_like) – sequence of values.
Returns:True if values are all finite.
Return type:bool
numpy_sugar._array.is_crescent(arr)[source]

Check if the array values are in non-decreasing order.

Parameters:arr (array_like) – sequence of values.
Returns:True for non-decreasing order.
Return type:bool
numpy_sugar._array.cartesian(shape)[source]

Cartesian indexing.

Returns a sequence of n-tuples indexing each element of a hypothetical matrix of the given shape.

Parameters:shape (tuple) – tuple of dimensions.
Returns:indices.
Return type:array_like

Example

>>> from numpy_sugar import cartesian
>>> print(cartesian((2, 3)))
[[0 0]
 [0 1]
 [0 2]
 [1 0]
 [1 1]
 [1 2]]

Reference:

[1] http://stackoverflow.com/a/27286794

numpy_sugar._array.is_all_equal(arr)[source]

Check if the array values are all equal.

Parameters:arr (array_like) – sequence of values.
Returns:True if values are all equal.
Return type:bool
numpy_sugar._array.is_all_finite(arr)[source]

Check if the array values are all finite.

Parameters:arr (array_like) – sequence of values.
Returns:True if values are all finite.
Return type:bool
numpy_sugar._array.is_crescent(arr)[source]

Check if the array values are in non-decreasing order.

Parameters:arr (array_like) – sequence of values.
Returns:True for non-decreasing order.
Return type:bool
numpy_sugar._array.unique(ar)[source]

Find the unique elements of an array.

It uses dask.array.unique if necessary.

Parameters:ar (array_like) – Input array.
Returns:the sorted unique elements.
Return type:array_like