我认为在两个数据框中,你的一些索引混乱了。为了解决这个问题,我建议按照以下方式重置每个数据框的索引:
movie_score.reset_index(drop = True, inplace = True)
movies_with_genres.reset_index(drop = True, inplace = True)
movie_score = pd.merge(movie_score,movies_with_genres,on='movieId')
df.set_index('movieId')
将该列设置为数据框的索引。