I have data of the following form:
"almond" "blueberry" 3
"almond" "leek" 6
"almond" "citron" 7
"almond" "fish" 2
...
"leek" "swiss_cheese" 3
"leek" "pumpkin" 5
"leek" "onion" 4
"leek" "chocolate" 10
...
For each value in the first column I want to find the k best partners according to the third column. "Best" means: lower number in the third row. Thus, for almond its three best partners are fish, blueberry, leek. For leek, its three best partners are swiss_cheese
, onion, and pumpkin. I finally want to reduce the full table to the three best partners for each of the factors in the first column, i.e.
"almond" "blueberry" 3
"almond" "leek" 6
"almond" "fish" 2
...
"leek" "swiss_cheese" 3
"leek" "pumpkin" 5
"leek" "onion" 4
...