open_in_new
content_copy
df.groupby('cluster', group_keys=False).apply(lambda df: df.sample(1))