Jan-04-2023, 09:43 AM
Hi
I want to get rows where all columns are True; I have supposed it has been "simple", but i do not understand why the following code does not work: what i'm missing?
Thanks
Paul
I want to get rows where all columns are True; I have supposed it has been "simple", but i do not understand why the following code does not work: what i'm missing?
Thanks
Paul
M = np.array([[False, True, False, True], [True, True, True, True], # OK [True, True, False, True], [True, True, True, False], [True, True, True, True]]) # OK loc = np.where(M[:, 0]) and np.where(M[:, 1]) and np.where(M[:, 2]) and np.where(M[:, 3]) print(f"loc = {loc}")
Output:loc = (array([0, 1, 2, 4], dtype=int64),)