ReplacePart
works with named pattern :
ReplacePart[tab, {i_, 2} :> Position[votes[[i, All]], ff][[1, 1]]]
Do not forget to use a delayed rule (:>
instead of ->
)
ReplacePart
is not memory/speed optimal. It may be slow and memory consuming with large data sets.