Hello everybody.

I have recently started learning NumPy (an extension of Python) and I am very confused by several things. In this post I would like help in one of them.

Let's say I have the following (forgive me if I do some mistake)

>>>a=arange(12) >>> a=a.reshape(3,4) >>> a array([[0,1,2,3], [4,5,6,7], [8,9,10,11]])

And also have some arrays of booleans say

>>>b1=array([False,True,True]) >>>b2=array([True,False,True,False])

Now, I do the following

>>>a[b1,:] array([[4,5,6,7], [8,9,10,11]]) >>>a[:,b2] array([[0,2], [4,6], [8,10]])

which is understandable.

But, __where on earth does the following come from???__

>>>a[b1,b2] array([4,10]

I mean, I can not understand where does that come from and how did it end up like that. I would think that would give a result such as

[[4,6] [8,10]]

Can someone help me understand this? I will be very grateful. Thanks in advance

**Edited by KansaiRobot, 12 February 2015 - 06:14 PM.**