Python NumPy transpose Function Example with use of tuples

32

# welcome to softhunt.net
# importing python module named numpy
import numpy as np

# making a 3x3 array
arr = np.array([[1, 2],
				[4, 5],
				[7, 8]])

# before transpose
print("Before transpose:\n", arr, end ='\n\n')

# after transpose
print("After transpose:\n", arr.transpose(1, 0))

Comments

Submit
0 Comments