numpy中切片和数组索引的组合

问题描述

查看以下问题的答案:How to understand numpy's combined slicing and indexing example

我仍然无法理解切片和两个1d数组的组合的索引结果,如下所示:

import SwiftUI

struct TestList: View {
  var body: some View {
    NavigationView{
      List {
        Text("hello world")
        Text("hello world")
        Text("hello world")
      }
      .listStyle(PlainListStyle())
      .navigationBarTitle(Text("Test List"),displayMode:.inline)
      .navigationBarItems(leading:
                            Image(systemName: "bell")
      )
    }
  }
}

struct TestList_Previews: PreviewProvider {
  static var previews: some View {
    TestList()
  }
}

为什么结果等于这个?

>>> m = np.arange(36).reshape(3,3,4)
>>> m
array([[[ 0,1,2,3],[ 4,5,6,7],[ 8,9,10,11]],[[12,13,14,15],[16,17,18,19],[20,21,22,23]],[[24,25,26,27],[28,29,30,31],[32,33,34,35]]])

>>> m[1:3,[2,1],1]]
array([[22,17],[34,29]])

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)