MCPcopy
hub / github.com/numpy/numpy / transpose

Function transpose

numpy/ma/core.py:7608–7644  ·  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 as np >>> import numpy.ma as ma >>> x = ma.a

(a, axes=None)

Source from the content-addressed store, hash-verified

7606
7607
7608def transpose(a, axes=None):
7609 """
7610 Permute the dimensions of an array.
7611
7612 This function is exactly equivalent to `numpy.transpose`.
7613
7614 See Also
7615 --------
7616 numpy.transpose : Equivalent function in top-level NumPy module.
7617
7618 Examples
7619 --------
7620 >>> import numpy as np
7621 >>> import numpy.ma as ma
7622 >>> x = ma.arange(4).reshape((2,2))
7623 >>> x[1, 1] = ma.masked
7624 >>> x
7625 masked_array(
7626 data=[[0, 1],
7627 [2, --]],
7628 mask=[[False, False],
7629 [False, True]],
7630 fill_value=999999)
7631
7632 >>> ma.transpose(x)
7633 masked_array(
7634 data=[[0, 2],
7635 [1, --]],
7636 mask=[[False, False],
7637 [False, True]],
7638 fill_value=999999)
7639 """
7640 # We can't use 'frommethod', as 'transpose' doesn't take keywords
7641 try:
7642 return a.transpose(axes)
7643 except AttributeError:
7644 return np.asarray(a).transpose(axes).view(MaskedArray)
7645
7646
7647def reshape(a, new_shape, order='C'):

Calls 1

viewMethod · 0.45

Used in the wild real call sites across dependent graphs

searching dependent graphs…