bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / sparse / _construct / swapaxes
function
scipy.sparse._construct:swapaxes
source: build-install/usr/lib/python3.14/site-packages/scipy/sparse/_construct.py:83
Signature
def swapaxes(A, axis1, axis2)Summary
Interchange two axes of an array.
Parameters
A: sparse arrayInput array.
axis1: intFirst axis.
axis2: intSecond axis.
Returns
a_swapped: sparse array in COO formatA copy of the input array with the two identified axes swapped.
Raises
: ValueErrorIf provided a non-integer or out of range
[-N, N-1]axis, whereNisA.ndim.
Examples
from scipy.sparse import coo_array, swapaxes A = coo_array([[[1, 2, 3], [2, 0, 0]]]) A.shape swapaxes(A, 1, 2).shape✓
(1, 3, 2)
Aliases
scipy.sparse.swapaxes