我对代码中出了什么问题感到困惑。我正在尝试建立一个酒店推荐系统。当我运行代码时,它符合但不显示任何输出。
def favoriteHotels(activeUser,N):
#1. subset the dataframe to have the rows corresponding to the active user
# 2. sort by the rating in descending order
# 3. pick the top N rows
topHotels = pd.DataFrame.sort(datay[datay.UserId==activeUser],['Rating'],ascending=[0])[:N]
# return the Ids of the corresponding hotels in hotels
return list(topHotels.Hotel_Id)
favoriteHotels(77,3) # Print the top 3 favorite Hotels of user 77