COO.reshape

COO.reshape(shape, order='C')[source]

Returns a new COO array that is a reshaped version of this array.

Parameters

shape (tuple[int]) – The desired shape of the output array.

Returns

The reshaped output array.

Return type

COO

See also

numpy.ndarray.reshape()

The equivalent Numpy function.

Notes

The order parameter is provided just for compatibility with Numpy and isn’t actually supported.

Examples

>>> s = COO.from_numpy(np.arange(25))
>>> s2 = s.reshape((5, 5))
>>> s2.todense()  # doctest: +NORMALIZE_WHITESPACE
array([[ 0,  1,  2,  3,  4],
       [ 5,  6,  7,  8,  9],
       [10, 11, 12, 13, 14],
       [15, 16, 17, 18, 19],
       [20, 21, 22, 23, 24]])