ABOUT :
numpy.matrix(data, dtype = None) : Class which returns a matrix from a string of data or array-like object. Matrix obtained is a specialised 2D array.
PARAMETERS :
-
data : data needs to be array-like or string.
-
dtype : data type of the array being returned.
RETURNS :
Interpretation of data as matrix
CODE :
# numpy.matrix class
import numpy as study
# string input
a = study.matrix('1 2 5 ; 3 4 6')
print("string input : \n", a, "\n")
# array-like input
b = study.matrix([[5, 6, 7], [4, 6, 6, 8]])
print("array-like input : \n", b)
Output :
string input : [[1 2 5] [3 4 6]] array-like input : [[[5, 6, 7] [4, 6, 6, 8]]]
For an query contact me at : https://www.linkedin.com/in/mohit-gupta-003512116/



