Removing Duplicates with hook_views_prerender
You do not need to do this - simply use Distinct.

Edit the View, open the Advanced section -> Query Settings -> check the "Distinct" checkbox and save the view.

Edit:
In case you do use Distinct already, there are some cases where this can occur. Here is an issue discussing this - https://www.drupal.org/node/1765730, and this one has a code example that manipulates the result similarly to what you are trying to do - https://www.drupal.org/node/1223448#comment-4757898