This is my code below
def recomend_book(book_name):
b_id = np.where(books_rating_pivot.index == book_name)[0][0]
_, recommendations = model.kneighbors(books_rating_pivot.iloc[b_id,:].values.reshape(1,-1))
for i in range(len(recommendations)):
if i == 0:
print(f"For book "{book_name}" is recommended")
if not i:
print(books_rating_pivot.index[recommendations[i]])
recomend_book('Harry')
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…