iXce / gmusicimport

Simple playlist importer for Google Play Music
14 stars 9 forks source link

Error occured when i executed the code #13

Closed gopal-gcek closed 3 years ago

gopal-gcek commented 5 years ago

hi i have successfully executed the code train_data, test_data = train_test_split(movie_df, test_size = 0.20, random_state=0) print(train_data.head(5))

but when i am trying to executed the code pm = Recommenders.popularity_recommender_py() pm.create(train_data, 'userId' , 'movie')

the following error are displayed

KeyError Traceback (most recent call last)

in 1 # Simple popularity based recommender...Not exclusive for a particular user 2 pm = Recommenders.popularity_recommender_py() ----> 3 pm.create(train_data, 'userId' , 'movie') ~/Recommender_system/Recommenders.py in create(self, train_data, user_id, item_id) 21 22 #Sort the movies based upon recommendation score ---> 23 train_data_sort = train_data_grouped.sort_values(['score', self.item_id], ascending = [0,1]) 24 25 #Generate a recommendation rank based upon score ~/anaconda3/lib/python3.7/site-packages/pandas/core/frame.py in sort_values(self, by, axis, ascending, inplace, kind, na_position) 4409 for x in by: 4410 k = self._get_label_or_level_values(x, axis=axis, -> 4411 stacklevel=stacklevel) 4412 keys.append(k) 4413 indexer = lexsort_indexer(keys, orders=ascending, ~/anaconda3/lib/python3.7/site-packages/pandas/core/generic.py in _get_label_or_level_values(self, key, axis, stacklevel) 1380 values = self.axes[axis].get_level_values(key)._values 1381 else: -> 1382 raise KeyError(key) 1383 1384 # Check for duplicates KeyError: 'score'