Say that I have a dataframe that looks like:
Name Group_Id
AAA 1
ABC 1
CCC 2
XYZ 2
DEF 3
YYH 3
How could I randomly select one (or more) row for each Group_Id
? Say that I want one random draw per Group_Id
, I would get:
Name Group_Id
AAA 1
XYZ 2
DEF 3
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…