users_grpd = pairs.groupByKey()
users_grpd_flattened = users_grpd.map(
lambda (k, vals): "{0} {1}".format(k, ' '.join(str(x) for x in vals)))
the first column in userid
and the rest of the columns are product ids. I would now like to sort the product ids per user. The number of products per user are not fixed, but will vary. Here is how users_grpd_flattened
looks like: Is there a way to efficiently sort the product ids/user?
userid product ids.............
30095212 208518 10519 208520 120821
3072220 20506 205037
209212 208518 10519 208520 120821
100222 20506 205037 10519 208520 120821 20116 124574 102575