【发布时间】:2019-03-29 10:44:07
【问题描述】:
我有一个形状为(1000, 4, 200)的数组
import numpy as np
array = np.ndarray((1000, 4, 200), dtype=int)
4用来表示通道数,200用来表示样本数,1000用来表示,嗯..时域(不知道怎么写)
我如何以特定的顺序遍历这个数组,这样当我打印数组的形状时,在 for 循环中,对于 200 个样本中的每一个,它都必须打印,
SAMPLE: 1
(1000, ) #Channel1
(1000, ) #Channel2
(1000, ) #Channel3
(1000, ) #Channel4
SAMPLE: 2
(1000, ) #Channel1
(1000, ) #Channel2
(1000, ) #Channel3
(1000, ) #Channel4
SAMPLE: 3
(1000, ) #Channel1
(1000, ) #Channel2
(1000, ) #Channel3
(1000, ) #Channel4
.
.
.
SAMPLE: 200
(1000, ) #Channel1
(1000, ) #Channel2
(1000, ) #Channel3
(1000, ) #Channel4
与其说我的打印语句应该准确,我只是希望能够以时域作为列向量一个接一个地提取每个通道..
我尝试了什么?
嗯.. 我没有做任何特别的事情,我只是有一个嵌套循环,从左到右遍历每个维度,这不是我想要的。
【问题讨论】:
标签: python python-3.x loops numpy multidimensional-array