June 2020
Intermediate to advanced
382 pages
11h 39m
English
A matrix is a two-dimensional data structure with a fixed number of columns and rows. Each element of a matrix can be referred to by its column and the row.
In Python, a matrix can be created by using the numpy array, as shown in the following code:
>>> myMatrix = np.array([[11, 12, 13], [21, 22, 23], [31, 32, 33]]) >>> print(myMatrix) [[11 12 13] [21 22 23] [31 32 33]]>>> print(type(myMatrix))<class 'numpy.ndarray'>
Note that the preceding code will create a matrix that has three rows and three columns.