Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  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)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement