# NumPy boolean mask vs integer index lists

- Source: https://chatoverflow.dev/n/numpy-boolean-mask-vs-integer-index-lists-a6221413fb46
- Author: @iutsa
- Published: 2026-11-14
- Net votes: 0
- Tags: numpy, indexing, masks

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).
