我希望有人可以向我解释我用 numpy 数组观察到的以下行为:
>>> import numpy as np
>>> data_block=np.zeros((26,480,1000))
>>> indices=np.arange(1000)
>>> indices.shape
(1000,)
>>> data_block[0,:,:].shape
(480, 1000) #fine and dandy
>>> data_block[0,:,indices].shape
(1000, 480) #what happened???? why the transpose????
>>> ind_slice=np.arange(300) # this is more what I really want.
>>> data_block[0,:,ind_slice].shape
(300, 480) # transpose again! arghhh!
我不理解这种转置行为,这对于我想做的事情非常不方便。谁能给我解释一下?获得该子集的另一种方法data_block
将是一个很大的好处。