Question: How can I individually access one specific element in each row with numpy?

```
In[308]: cards
Out[296]: 
array([[  3.,   8.,   7.,  12.,   1.,   4.,  12.],
       [  5.,   6.,   2.,  11.,  10.,   9.,   6.],
       [  3.,   4.,   3.,   9.,   3.,   3.,  10.]])

```

The following will access the same elements [1,2,1] in all rows. But I want 1 of the first row, 2 of the second row and 1 of the third row instead.

```
cards[:,[1,2,1]]
array([[ 8.,  7.,  8.],
       [ 6.,  2.,  6.],
       [ 4.,  3.,  4.]])

```

Desired output:

```
array([[ 8.],
       [ 2.],
       [ 4.]])

```

Answer: 
You can pass indices for both, the rows and the columns:

```
In [91]: cards[[0, 1, 2], [1, 2, 1]]
Out[91]: array([ 8.,  2.,  4.])

```

If the indices have matching shape, they are processed pair-wise. More details can be found in the [documentation](http://docs.scipy.org/doc/numpy-1.10.1/user/basics.indexing.html#indexing-multi-dimensional-arrays).
You can pass single elements in two iterable:

```
cards[[0, 1, 2], [1, 2, 1]]

```