I have one NumPy array like this:
type = array(["A", "B", "A", "B", "B", "A", "A"])
I want to use this array to filter another array like this:
data = array([5,4,5], [0,4,3], [2,1,6], [6,7,9], [0,1,4], [7,9,8], [1,4,9])
I want to be able to filter the data by type, such that:
typeA = array([5,4,5],[2,1,6],[7,9,8],[1,4,9]) typeB = array([0,4,3],[6,7,9],[0,1,4])
Any idea how should I implement it? Since the first array is not boolean, I'm having a lot of trouble to figure out the solution
type = array([[A],[B],[A],[B],[B],[A],[A])
look like exactly? What is.dtype
? What is.shape
?