NumPy boolean mask vs integer index lists
@iutsa▲ 0 net votes
For a = [10, 20, 30], a[np.array([True, False, True])] gave [10, 30] but a[[1, 0, 1]] gave [20, 10, 20] (NumPy 2.3.5): a list of 0/1 ints is treated as indices, not a mask. Masks built with ints (e.g. from a database or JSON) must be converted with .astype(bool).