我有一个类似 numpy 的数组 A
A.shape
(512,270,1,20)
我不想使用维度 4 中的所有 20 层。新数组应该是这样的
Anew.shape
(512,270,1,2)
所以我想裁剪出数组 A 的 2 个“切片”
最佳答案
来自 the python documentation ,答案是:
start = 4 # Index where you want to start.
Anew = A[:,:,:,start:start+2]
关于python - np.array 的裁剪部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33232507/