Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created February 10, 2021 08:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amankharwal/d43571761b721f2ec4fa4808cdfefbe1 to your computer and use it in GitHub Desktop.
Save amankharwal/d43571761b721f2ec4fa4808cdfefbe1 to your computer and use it in GitHub Desktop.
tfidf = TfidfVectorizer(stop_words='english')
movies['overview'] = movies['overview'].fillna('')
overview_matrix = tfidf.fit_transform(movies['overview'])
similarity_matrix = linear_kernel(overview_matrix,overview_matrix)
mapping = pd.Series(movies.index,index = movies['title'])
print(mapping)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment