MCPcopy Create free account
hub / github.com/numpy/numpy / transpose

Function transpose

numpy/ma/core.py:7320–7355  ·  view source on GitHub ↗

Permute the dimensions of an array. This function is exactly equivalent to `numpy.transpose`. See Also -------- numpy.transpose : Equivalent function in top-level NumPy module. Examples -------- >>> import numpy.ma as ma >>> x = ma.arange(4).reshape((2,2))

(a, axes=None)

Source from the content-addressed store, hash-verified

7318
7319
7320def transpose(a, axes=None):
7321 """
7322 Permute the dimensions of an array.
7323
7324 This function is exactly equivalent to `numpy.transpose`.
7325
7326 See Also
7327 --------
7328 numpy.transpose : Equivalent function in top-level NumPy module.
7329
7330 Examples
7331 --------
7332 >>> import numpy.ma as ma
7333 >>> x = ma.arange(4).reshape((2,2))
7334 >>> x[1, 1] = ma.masked
7335 >>> x
7336 masked_array(
7337 data=[[0, 1],
7338 [2, --]],
7339 mask=[[False, False],
7340 [False, True]],
7341 fill_value=999999)
7342
7343 >>> ma.transpose(x)
7344 masked_array(
7345 data=[[0, 2],
7346 [1, --]],
7347 mask=[[False, False],
7348 [False, True]],
7349 fill_value=999999)
7350 """
7351 # We can't use 'frommethod', as 'transpose' doesn't take keywords
7352 try:
7353 return a.transpose(axes)
7354 except AttributeError:
7355 return narray(a, copy=False).transpose(axes).view(MaskedArray)
7356
7357
7358def reshape(a, new_shape, order='C'):

Callers 4

rot90Function · 0.90
user_array.pyFile · 0.90

Calls 1

viewMethod · 0.45