You can use StatsBase.sample
to sample without replacement, and (optionally) keep the order:
using StatsBase, DataFrames
myDF = DataFrame(A = 1:10, B = 21:30)
myDF[sample(axes(myDF, 1), 3; replace = false, ordered = true), :]
You can use StatsBase.sample
to sample without replacement, and (optionally) keep the order:
using StatsBase, DataFrames
myDF = DataFrame(A = 1:10, B = 21:30)
myDF[sample(axes(myDF, 1), 3; replace = false, ordered = true), :]