dglai / WWW20-Hands-on-Tutorial

Materials for DGL hands-on tutorial in WWW 2020
502 stars 145 forks source link

KeyError: 'Passing list-likes to .loc or [] with any missing labels is no longer supported #2

Open annabechang opened 4 years ago

annabechang commented 4 years ago

Hi, I am running the recommendation-fism.jupyter file (WWW20-Hands-on-Tutorial-master/_legacy/advanced_apps/rec) and run into this error while executing the following line:

from movielens import MovieLens
data = MovieLens('.')
File not found. Downloading from https://s3.us-east-2.amazonaws.com/dgl.ai/dataset/movielens.tar.gz
Download finished. Unzipping the file...
Use device: cpu
---
Loading: tokenize
With settings: 
{'model_path': '/home/anna/stanfordnlp_resources/en_ewt_models/en_ewt_tokenizer.pt', 'lang': 'en', 'shorthand': 'en_ewt', 'mode': 'predict'}
  0%|          | 0/3702 [00:00<?, ?it/s]
---
Loading: lemma
With settings: 
{'model_path': '/home/anna/stanfordnlp_resources/en_ewt_models/en_ewt_lemmatizer.pt', 'lang': 'en', 'shorthand': 'en_ewt', 'mode': 'predict'}
Building an attentional Seq2Seq model...
Using a Bi-LSTM encoder
Using soft attention for LSTM.
Finetune all embeddings.
[Running seq2seq lemmatizer with edit classifier]
Done loading processors!
---
100%|██████████| 3702/3702 [00:39<00:00, 93.45it/s] 
100%|██████████| 3702/3702 [00:00<00:00, 93133.52it/s]
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-6-63a521714800> in <module>
      1 from movielens import MovieLens
----> 2 data = MovieLens('.')

~/Dropbox/python/python_courses/GNN/DGL/WWW20-Hands-on-Tutorial-master/_legacy/advanced_apps/rec/movielens.py in __init__(self, directory, neg_size)
    162 
    163         for u in range(len(self.users)):
--> 164             interacted_movies = self.ratings['movie_idx'][rating_groups.indices[u]]
    165             timerank = self.ratings['timerank'][rating_groups.indices[u]]
    166 

~/anaconda3/envs/tfgpu/lib/python3.7/site-packages/pandas/core/series.py in __getitem__(self, key)
    908             key = check_bool_indexer(self.index, key)
    909 
--> 910         return self._get_with(key)
    911 
    912     def _get_with(self, key):

~/anaconda3/envs/tfgpu/lib/python3.7/site-packages/pandas/core/series.py in _get_with(self, key)
    941         if key_type == "integer":
    942             if self.index.is_integer() or self.index.is_floating():
--> 943                 return self.loc[key]
    944             else:
    945                 return self._get_values(key)

~/anaconda3/envs/tfgpu/lib/python3.7/site-packages/pandas/core/indexing.py in __getitem__(self, key)
   1765 
   1766             maybe_callable = com.apply_if_callable(key, self.obj)
-> 1767             return self._getitem_axis(maybe_callable, axis=axis)
   1768 
   1769     def _is_scalar_access(self, key: Tuple):

~/anaconda3/envs/tfgpu/lib/python3.7/site-packages/pandas/core/indexing.py in _getitem_axis(self, key, axis)
   1951                     raise ValueError("Cannot index with multidimensional key")
   1952 
-> 1953                 return self._getitem_iterable(key, axis=axis)
   1954 
   1955             # nested tuple slicing

~/anaconda3/envs/tfgpu/lib/python3.7/site-packages/pandas/core/indexing.py in _getitem_iterable(self, key, axis)
   1592         else:
   1593             # A collection of keys
-> 1594             keyarr, indexer = self._get_listlike_indexer(key, axis, raise_missing=False)
   1595             return self.obj._reindex_with_indexers(
   1596                 {axis: [keyarr, indexer]}, copy=True, allow_dups=True

~/anaconda3/envs/tfgpu/lib/python3.7/site-packages/pandas/core/indexing.py in _get_listlike_indexer(self, key, axis, raise_missing)
   1550 
   1551         self._validate_read_indexer(
-> 1552             keyarr, indexer, o._get_axis_number(axis), raise_missing=raise_missing
   1553         )
   1554         return keyarr, indexer

~/anaconda3/envs/tfgpu/lib/python3.7/site-packages/pandas/core/indexing.py in _validate_read_indexer(self, key, indexer, axis, raise_missing)
   1652             if not (ax.is_categorical() or ax.is_interval()):
   1653                 raise KeyError(
-> 1654                     "Passing list-likes to .loc or [] with any missing labels "
   1655                     "is no longer supported, see "
   1656                     "https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#deprecate-loc-reindex-listlike"  # noqa:E501

KeyError: 'Passing list-likes to .loc or [] with any missing labels is no longer supported, see https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#deprecate-loc-reindex-listlike'

I am using anoconda env with: py 3.7 tf 2.1 nvidia 10.1

thanks.