dimanche 19 août 2018

Get random From Spark Dataframe

Bellow is the dataframe i had:

|       person_id |         group_id  | recommend_type     

|1000000001005710 | 20180817095158758 | food_recommend
|2076             | 20180817095158938 | food_recommend
|1000000001007007 | 20180817095158650 | food_recommend
|1978             | 20180817095158493 | food_recommend

The truth is: one person_id has one thousand group_id. But what i need is: one person_id has about 10 group_id.How can I get 10 random group_id from such df?




Aucun commentaire:

Enregistrer un commentaire