Python: Zufällige Auswahl pro Gruppe

Sagen, dass ich ein dataframe, das aussieht wie:

Name Group_Id
AAA  1
ABC  1
CCC  2
XYZ  2
DEF  3 
YYH  3

Wie könnte ich nach dem Zufallsprinzip wählen Sie eine (oder mehrere) Zeile für jede Group_Id? Sagen, dass ich will eine Ziehung pro Group_Id würde ich bekommen:

Name Group_Id
AAA  1
XYZ  2
DEF  3
InformationsquelleAutor Plug4 | 2014-03-18
Schreibe einen Kommentar