method one :
sklearn中shuffle的方法。
- from sklearn.utils import shuffle
- df = shuffle(df)
对df进行shuffle。其中参数frac是要返回的比例.
- df.sample(frac=1)
需要打混后数据集的index(索引)还是按照正常的排序。我们只需要这样操作
- df.sample(frac=1).reset_index(drop=True)
method one :
sklearn中shuffle的方法。
对df进行shuffle。其中参数frac是要返回的比例.
需要打混后数据集的index(索引)还是按照正常的排序。我们只需要这样操作