Answers for "difference between numpy array and matrix"

CSS
0

difference between numpy array and matrix

import numpy as np

a = np.array([[4, 3], [2, 1]])
b = np.array([[1, 2], [3, 4]])
print(a@b)
# [[13 20]
#  [ 5  8]]
Posted by: Guest on February-09-2021
0

difference between numpy array and matrix

import numpy as np

a = np.mat('4 3; 2 1')
b = np.mat('1 2; 3 4')
print(a)
# [[4 3]
#  [2 1]]
print(b)
# [[1 2]
#  [3 4]]
print(a*b)
# [[13 20]
#  [ 5  8]]
Posted by: Guest on February-09-2021
-2

numpy difference between two arrays

import numpy as np
result = np.subtract([1.1, 2.2, 3.3], [1, 2, 3])
Posted by: Guest on December-29-2020

Code answers related to "difference between numpy array and matrix"

Browse Popular Code Answers by Language