Question: I have an numpy array of size NxD called X. 

I have created a mask of size D represented by a numpy vector with 1 and 0 called ind\_delete 

I would like to delete all column of X corresponding to 1 in ind\_delete.

I have tried:

```
X = np.delete(X,ind_delete,1)

```

but it obviously does not work. I have tried to find an easy way to to that on python but as it is trivial in matlab, it seems not as much here. Thanks for pointing out the best way to achieve it.

Answer: 
[Boolean array indexing](https://docs.scipy.org/doc/numpy-1.13.0/reference/arrays.indexing.html#boolean-array-indexing):

```
>>> x = np.array([[1, 2, 3],
...               [4, 5, 6]])
>>> d = np.array([1, 0, 1])
>>> x[:, d==1]
array([[1, 3],
       [4, 6]])

```
You need to create a boolean array and you can select what you want:

```
X = X[ind_delete!=1]

```

Selects the positions for where the value is not 1.