Python | Numpy matrix.getA1() (original) (raw)
Last Updated : 15 Apr, 2019
With the help of **Numpy matrix.getA1()**
method, we can get the ndarray of one dimension as of our given matrix.
Syntax :
matrix.getA1()
Return : Return ndarray of size 1-D as given matrix
Example #1 :
In this example we can see that we are able to get the numpy array with the help of method matrix.getA1()
.
import
numpy as np
gfg
=
np.matrix(
'[6; 2; 3]'
)
geeks
=
gfg.getA1()
print
(geeks)
Example #2 :
import
numpy as np
gfg
=
np.matrix(
'[1, 2, 3; 4, 5, 6; 7, 8, 9]'
)
geeks
=
gfg.getA1()
print
(geeks)
Output:
[1 2 3 4 5 6 7 8 9]
Similar Reads
- 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.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 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 matrix.sum() With the help of matrix.sum() method, we are able to find the sum of values in a matrix by using the same method. Syntax : matrix.sum() Return : Return sum of values in a matrix Example #1 : In this example we are able to find the sum of values in a matrix by using matrix.sum() method. # import the 1 min read
- Python | Numpy matrix.var() With the help of Numpy matrix.var() method, we can find the variance of a matrix by using the matrix.var() method. Syntax : matrix.var() Return : Return variance of a matrix Example #1 : In this example we can see that by using matrix.var() method we are able to find the variance of a given matrix. 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
- Python | Numpy matrix.view() With the help of Numpy matrix.view() method, we can find the new view of a the matrix by using the matrix.view() method. Syntax : matrix.view() Return : Return new view for same matrix Example #1 : In this example we can see that by using matrix.view() method we are able to find the new view of the 1 min read
- Python | Numpy numpy.matrix.any() With the help of Numpy numpy.matrix.any() method, we are able to compare each and every element of one matrix with another or we can provide the axis on the we want to apply comparison if any of the element matches it return true. Syntax : numpy.matrix.any() Return : Return true if any match found e 1 min read
- Python | Numpy getmask() method With the help of numpy.getmask() method, we can get the masked matrix of numpy array which shows masked values by using numpy.getmask() method. Syntax : numpy.getmask(array) Return : Return masked values of a matrix. Example #1 : In this example we can see that by using numpy.getmask() method, we ar 1 min read
- numpy.matrix.A() function - Python numpy.matrix.A() function return self as an ndarray object. Syntax : numpy.matrix.A() Parameters : None Return : [ndarray] Return self as an ndarray. Code #1 : # Python program explaining # numpy.matrix.A() function # importing numpy as geek import numpy as geek mat = geek.matrix(geek.arange(9).resh 1 min read