Random row selection in Pandas dataframe

后端 未结 6 1300
深忆病人
深忆病人 2020-11-28 02:52

Is there a way to select random rows from a DataFrame in Pandas.

In R, using the car package, there is a useful function some(x, n) which is similar to h

6条回答
  •  鱼传尺愫
    2020-11-28 03:11

    Actually this will give you repeated indices np.random.random_integers(0, len(df), N) where N is a large number.

提交回复
热议问题