pandas sample函数

使用pd.sample()随机选取N行数据

df.sample(n=None, frac=None, replace=False, weights=None, random_state=None, axis=None)
输入参数见下表所示:


在df.sample()函数中设置frac=1.0时可以实现shuffle

另外一种shffule方法

posted @ 2021-06-21 12:27  爱吃砂糖橘的白龙  阅读(228)  评论(0编辑  收藏  举报