对于数据科学应用程序,我需要先随机整理矩阵的行,然后再进行处理。
有没有一种方法,不仅可以获取索引,对索引进行改组,然后将经过改组的索引传递给矩阵?如:
indx = np.asarray(list(range(0, data.shape[0], 1)))
shufIndx = shuffle(indx)
data = data[shufIndx,:]
return (data)
谢谢!
对于数据科学应用程序,我需要先随机整理矩阵的行,然后再进行处理。
有没有一种方法,不仅可以获取索引,对索引进行改组,然后将经过改组的索引传递给矩阵?如:
indx = np.asarray(list(range(0, data.shape[0], 1)))
shufIndx = shuffle(indx)
data = data[shufIndx,:]
return (data)
谢谢!
With
python
(notnumpy
), you can directlyrandom.shuffle
the rows:样本输出: