Ilan - 1 year ago 255

Python Question

I need to create a function or equation that will turn this input...

`a = [True, False, True]`

b = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]

into this output...

`c = [[1, 3], [4, 6], [7, 9]]`

Note: the above arrays are all numpy arrays. Thanks!

Recommended for you: Get network issues from **WhatsUp Gold**. **Not end users.**

Answer Source

`numpy`

solution

```
import numpy as np
a = np.array([True, False, True])
b = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
b[:,a]
array([[1, 3],
[4, 6],
[7, 9]])
```

Recommended from our users: **Dynamic Network Monitoring from WhatsUp Gold from IPSwitch**. ** Free Download**