【发布时间】:2012-04-10 14:30:08
【问题描述】:
我是使用 numpy 的新手,我真的不明白的一件事是索引数组。
tentative tutorial中有这个例子:
>>> a = arange(12).reshape(3,4)
>>> b1 = array([False,True,True]) # first dim selection
>>> b2 = array([True,False,True,False]) # second dim selection
>>>
>>> a[b1,b2] # a weird thing to do
array([ 4, 10])
我不知道为什么它会做最后一件事。谁能给我解释一下?
谢谢!
【问题讨论】:
标签: python arrays numpy indexing scipy