Python | Numpy numpy.matrix.T() (original) (raw)
Last Updated : 08 Apr, 2019
With the help of **Numpy numpy.matrix.T()**
method, we can make a Transpose of any matrix either having dimension one or more than more.
Syntax :
numpy.matrix.T()
Return : Return transpose of every matrix
Example #1 :
In this example we can see that with the help of matrix.T()
method, we are able to transform any type of matrix.
import
numpy as np
gfg
=
np.matrix(
'[1, 2, 3, 4]'
)
geeks
=
gfg.getT()
print
(geeks)
Output:
[[1] [2] [3] [4]]
Example #2 :
import
numpy as np
gfg
=
np.matrix(
'[1, 2, 3; 4, 5, 6; 7, 8, 9]'
)
geeks
=
gfg.getT()
print
(geeks)
Output:
[[1 4 7] [2 5 8] [3 6 9]]
Similar Reads
- Python | Numpy numpy.matrix.A() With the help of Numpy numpy.matrix.A() method, we can get the same matrix as self. It means through this method we can get the identical matrix. Syntax : numpy.matrix.A() Return : Return self matrix Example #1 : In this example we can see that with the help of matrix.A() method, we are able to get 1 min read
- Python | Numpy numpy.matrix.H() With the help of Numpy numpy.matrix.H() method, we can make a conjugate Transpose of any complex matrix either having dimension one or more than more. Syntax : numpy.matrix.H() Return : Return conjugate transpose of every complex matrix Example #1 : In this example we can see that with the help of m 1 min read
- numpy.asmatrix() in Python numpy.asmatrix(data, dtype = None) Returns a matrix by interpreting the input as a matrix. Parameters : data : array-like input data dtype : Data type of returned array Returns : Interprets the input as a matrix # Python Programming illustrating # numpy.asmatrix import numpy as geek # array-like inp 1 min read
- Python | Numpy matrix.take() With the help of Numpy matrix.take() method, we can select the elements from a given matrix by passing the parameter as index value of that element. It will return a matrix having one dimension. Remember it will work for one axis at a time. Syntax : matrix.take(index, axis) Return : Return matrix of 1 min read
- numpy.matrix() in Python This class returns a matrix from a string of data or array-like object. Matrix obtained is a specialised 2D array. Syntax : numpy.matrix(data, dtype = None) : Parameters : data : data needs to be array-like or string dtype : Data type of returned array. Returns : data interpreted as a matrix # Pytho 1 min read
- numpy.bmat() in Python numpy.bmat(obj, l_dict = None, g_dict = None) : Return specialised 2-D matrix from nested objects that can be string-like or array-like. Parameters : object : array-like or string l_dict : (dict, optional) replaces local operands, A dictionary that replaces local operands in current frame g_dict : ( 2 min read
- Python | Numpy numpy.ndarray.__imul__() With the help of numpy.ndarray.__imul__() method, we can multiply a particular value that is provided as a parameter in the ndarray.__imul__() method. Value will be multiplied to every element in a numpy array. Syntax: ndarray.__imul__($self, value, /)Return: self*=value Example #1 : In this example 1 min read
- Python | Numpy matrix.transpose() With the help of Numpy matrix.transpose() method, we can find the transpose of the matrix by using the matrix.transpose()method in Python. Numpy matrix.transpose() Syntax Syntax : matrix.transpose() Parameter: No parameters; transposes the matrix it is called on. Return : Return transposed matrix Wh 3 min read
- numpy.tri() in Python numpy.tri(R, C = None, k = 0, dtype = 'float') : Creates an array with 1's at and below the given diagonal(about k) and 0's elsewhere. Parameters : R : Number of rows C : [optional] Number of columns; By default R = C k : [int, optional, 0 by default] Diagonal we require; k>0 means diagonal above 2 min read
- numpy.tan() in Python numpy.tan(array[, out]) = ufunc 'tan') : This mathematical function helps user to calculate trigonometric tangent for all x(being the array elements). Parameters : array : [array_like]elements are in radians. out : [optional]shape same as array. 2pi Radians = 360 degrees tan(x) = sin(x) / cos(x) Ret 2 min read