numpy.swapaxes() in Python

The numpy.swapaxes() function interchanges the two specified axes of the given array.

Syntax

Parameter

The numpy.swapaxes() method consists of three parameters, which are as follows:

a : This parameter represents the Input array.

axis1 : It represents the first axis.

axis2 : It signifies the second axis.

Return

This function returns the view of parameter ‘a’ if ‘a’ is a ndarray, else a new array is created.

Example 1

Output

Pin It on Pinterest

Share This