After some transformations I got the following dataframe
, how do I proceed to obtain the top n records by a column in this case short_name
and using other as indicator frequency
. I read this post but the problem with both solutions is that they get rid of the column product_name
, they just retain the grouped column and I need to keep them all.
short_name product_id frequency
Yoghurt y cereales 975009684 32
Yoghurt y cereales 975009685 21
Yoghurt y cereales 975009700 16
Yoghurt y Cereales 21097 16
Yoghurt Bebible 21329 68
Yoghurt Bebible 21328 67
Yoghurt Bebible 21500 31