  # Python | Numpy numpy.matrix.any ()

NumPy | Python Methods and Functions

With the ` Numpy numpy.matrix.any () ` method, we can compare each element of one matrix to another, or we can provide the axis on which we want to apply the comparison if any element matches this it returns true

Syntax: `numpy.matrix.any()`

Return: Return true if any match found else false

Example # 1:
In this example, we see that using the ` matrix.any () ` method we can compare any two matrices that have different sizes, and if ` matrix.any () ` any match, return true.

 ` # import important module into python ` ` import ` ` numpy as np `   ` # make a matrix with NumPy ` ` gfg1 ` ` = np.matrix ( `[1, 2, 3, 4]` ) `` gfg2 = np.matrix ( `[1, 2]` )   # using the matrix.any () method geeks = (gfg1 = = gfg2). any ()   print (geeks) `

Exit:

` True `

Pr Number 2:

 ` # import important module into python ` ` import ` ` numpy as np `   ` # make a matrix with NumPy ` ` gfg1 ` ` = ` ` np.matrix (` `` [1, 2, 3; 4, 5, 6; 7, 8, 9] `` `) ` ` gfg2 ` ` = ` ` np.matrix (` `` [1, 2, 3] `` `) ` ` `  ` # using the matrix.any () method `` geeks = (gfg1 = = gfg2). any ()   print (geeks) `

Exit:

` True `