我有以下numpy数组维数:[64, 897]。此数据是在每次实验后生成的。我总共有8个实验对象,每个对象我做了6次实验。
因此,我希望在最后有一个大小如下的4维数组:[8, 6, 64, 897]。
我如何在python的numpy中实现这一点。
任何帮助都非常感谢!
发布于 2019-09-09 07:06:52
根据@rafaelc的说法,以下是解决方案:
total_slices = []
for i in range(8):
slices_ = []
for j in range(6):
slices = result_of_experiment() # This will return an np.array of shape: [64, 8970
slices_.append(slices)
slices = np.stack(slices_, axis=0)
print("slices.shape", slices.shape)
total_slices.append(slices)
total_slices = np.stack(total_slices, axis=0)
print("total_slices.shape", total_slices.shape)https://stackoverflow.com/questions/57846344
复制相似问题