HTTP/1.1 301 Moved Permanently
Date: Sun, 27 Jul 2025 19:32:52 GMT
Server: Apache/2.4.39 (Ubuntu)
Location: https://numpy.org/doc/stable/reference/generated/numpy.ndarray.transpose.html
Content-Length: 366
Content-Type: text/html; charset=iso-8859-1
HTTP/2 200
date: Sun, 27 Jul 2025 19:32:52 GMT
content-type: text/html; charset=utf-8
server: cloudflare
x-origin-cache: HIT
last-modified: Fri, 25 Jul 2025 11:41:59 GMT
access-control-allow-origin: *
expires: Sun, 27 Jul 2025 19:42:52 GMT
cache-control: max-age=600
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=WPTtM%2FydhNcDyK61%2BEfB0bvRBifePZgJ9pwBbWtftBE5mM%2BzfW2tlrftyOCWKoUG%2BNOIxpNSxT6gen04QQ912AO7QFG9OzSfGA%3D%3D"}]}
x-proxy-cache: MISS
x-github-request-id: 9FD2:2A0129:178084:1BDD42:68867EE3
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
age: 0
via: 1.1 varnish
x-served-by: cache-bom-vanm7210023-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1753644772.311637,VS0,VE214
vary: Accept-Encoding
x-fastly-request-id: b6d96985b545c582566d9ab01798ed71aba7ed92
cf-cache-status: DYNAMIC
content-encoding: gzip
cf-ray: 965e90b2b974cf40-BOM
alt-svc: h3=":443"; ma=86400
numpy.ndarray.transpose — NumPy v2.3 Manual
numpy.ndarray.transpose
method
-
ndarray.transpose(*axes)
Returns a view of the array with axes transposed.
Refer to numpy.transpose
for full documentation.
- Parameters:
- axesNone, tuple of ints, or n ints
None or no argument: reverses the order of the axes.
tuple of ints: i in the j-th place in the tuple means that the
array’s i-th axis becomes the transposed array’s j-th axis.
n ints: same as an n-tuple of the same ints (this form is
intended simply as a “convenience” alternative to the tuple form).
- Returns:
- pndarray
View of the array with its axes suitably permuted.
See also
transpose
Equivalent function.
ndarray.T
Array property returning the array transposed.
ndarray.reshape
Give a new shape to an array without changing its data.
Examples
>>> import numpy as np
>>> a = np.array([[1, 2], [3, 4]])
>>> a
array([[1, 2],
[3, 4]])
>>> a.transpose()
array([[1, 3],
[2, 4]])
>>> a.transpose((1, 0))
array([[1, 3],
[2, 4]])
>>> a.transpose(1, 0)
array([[1, 3],
[2, 4]])
>>> a = np.array([1, 2, 3, 4])
>>> a
array([1, 2, 3, 4])
>>> a.transpose()
array([1, 2, 3, 4])