a guest Apr 18th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def find_neighbor_titles(movies, indices):
  2.     titles = indices.copy()
  3.     K = indices.shape[1]
  4.     for i in range(K):
  5.         titles = titles.merge(movies[['title']], left_on=i, right_index=True, how="left")
  6.         titles = titles.rename(columns={'title': 'title_{}'.format(i+1)})
  7.     return titles.drop(list(range(K)), axis=1)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand