There are two numpy arrays, a and b. I want to know if the element of b is included in a ...
example.py
import numpy as np
a = np.array([[1,2,3],[2,3,4],[4,5,6]])
b = np.array([4,5,6])
(a==b).all(axis=1).any()
Result ↓
True
A function that returns True when all elements are true
【argument】 ・ Axis Specifying 0 returns the result in the row direction, and specifying 1 returns the result in the column direction.
A function that returns True when any element is true
Recommended Posts