virgesmith/neworder

Uses deprecated pandas accessor: "Passing list-likes to .loc or [] with any missing labels is no longer supported."

Closed this issue · 6 comments

File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/core/indexing.py", line 1321, in _validate_read_indexer
    raise KeyError(
KeyError: "Passing list-likes to .loc or [] with any missing labels is no longer supported. The following labels were missing: Int64Index([6719, 5046, 2701, 1495, 1034,\n            ...\n            7209, 2425, 8597, 2434, 1847],\n           dtype='int64', name='id', length=221). See https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#deprecate-loc-reindex-listlike"

This is associated with openjournals/joss-reviews#3351

@platipodium can you give me some context i.e. which example you were running to get this error?
(I will test all the examples anyway)

Ups, forgot to paste the command line (`mpirun -np 4 examples/wolf-sheep/model.py) and python trace

 File "/Users/Lemmen/devel/python/neworder/examples/wolf-sheep/model.py", line 34, in <module>
Traceback (most recent call last):
  File "/Users/Lemmen/devel/python/neworder/examples/wolf-sheep/model.py", line 34, in <module>
Traceback (most recent call last):
  File "/Users/Lemmen/devel/python/neworder/examples/wolf-sheep/model.py", line 34, in <module>
Traceback (most recent call last):
  File "/Users/Lemmen/devel/python/neworder/examples/wolf-sheep/model.py", line 34, in <module>
    no.run(m)
  File "/Users/Lemmen/devel/python/neworder/examples/wolf-sheep/wolf_sheep.py", line 96, in step
    no.run(m)
  File "/Users/Lemmen/devel/python/neworder/examples/wolf-sheep/wolf_sheep.py", line 96, in step
    self.__step_sheep()
  File "/Users/Lemmen/devel/python/neworder/examples/wolf-sheep/wolf_sheep.py", line 158, in __step_sheep
    no.run(m)
  File "/Users/Lemmen/devel/python/neworder/examples/wolf-sheep/wolf_sheep.py", line 96, in step
    no.run(m)
  File "/Users/Lemmen/devel/python/neworder/examples/wolf-sheep/wolf_sheep.py", line 96, in step
    self.__step_sheep()
  File "/Users/Lemmen/devel/python/neworder/examples/wolf-sheep/wolf_sheep.py", line 158, in __step_sheep
    self.__step_sheep()
  File "/Users/Lemmen/devel/python/neworder/examples/wolf-sheep/wolf_sheep.py", line 158, in __step_sheep
    grass_available = self.grass.loc[self.sheep.cell]
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/core/indexing.py", line 895, in __getitem__
    self.__step_sheep()
  File "/Users/Lemmen/devel/python/neworder/examples/wolf-sheep/wolf_sheep.py", line 158, in __step_sheep
    grass_available = self.grass.loc[self.sheep.cell]
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/core/indexing.py", line 895, in __getitem__
    grass_available = self.grass.loc[self.sheep.cell]
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/core/indexing.py", line 895, in __getitem__
    return self._getitem_axis(maybe_callable, axis=axis)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/core/indexing.py", line 1113, in _getitem_axis
    return self._getitem_axis(maybe_callable, axis=axis)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/core/indexing.py", line 1113, in _getitem_axis
    grass_available = self.grass.loc[self.sheep.cell]
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/core/indexing.py", line 895, in __getitem__
    return self._getitem_axis(maybe_callable, axis=axis)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/core/indexing.py", line 1113, in _getitem_axis
    return self._getitem_iterable(key, axis=axis)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/core/indexing.py", line 1053, in _getitem_iterable
    return self._getitem_iterable(key, axis=axis)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/core/indexing.py", line 1053, in _getitem_iterable
    return self._getitem_axis(maybe_callable, axis=axis)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/core/indexing.py", line 1113, in _getitem_axis
    return self._getitem_iterable(key, axis=axis)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/core/indexing.py", line 1053, in _getitem_iterable
    keyarr, indexer = self._get_listlike_indexer(key, axis, raise_missing=False)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/core/indexing.py", line 1266, in _get_listlike_indexer
    keyarr, indexer = self._get_listlike_indexer(key, axis, raise_missing=False)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/core/indexing.py", line 1266, in _get_listlike_indexer
    keyarr, indexer = self._get_listlike_indexer(key, axis, raise_missing=False)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/core/indexing.py", line 1266, in _get_listlike_indexer
    return self._getitem_iterable(key, axis=axis)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/core/indexing.py", line 1053, in _getitem_iterable
    self._validate_read_indexer(keyarr, indexer, axis, raise_missing=raise_missing)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/core/indexing.py", line 1321, in _validate_read_indexer
    self._validate_read_indexer(keyarr, indexer, axis, raise_missing=raise_missing)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/core/indexing.py", line 1321, in _validate_read_indexer
    keyarr, indexer = self._get_listlike_indexer(key, axis, raise_missing=False)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/core/indexing.py", line 1266, in _get_listlike_indexer
    self._validate_read_indexer(keyarr, indexer, axis, raise_missing=raise_missing)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/core/indexing.py", line 1321, in _validate_read_indexer
    raise KeyError(
KeyError: "Passing list-likes to .loc or [] with any missing labels is no longer supported. The following labels were missing: Int64Index([9469, 7551, 3445, 7827, 2072,\n            ...\n            9849, 2135, 8400, 7497, 5643],\n           dtype='int64', name='id', length=228). See https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#deprecate-loc-reindex-listlike"

this example is another that isn't intended to be run in parallel - it doesn't have any logic to divide up the computation to run on multiple processes. having said that, the actual error is distinctly unobvious (and I don't get this error running serially) so I'm just going to add an assertion that it's running in serial mode, hope this is sufficient

@platipodium I'll close this one too unless you respond otherwise

Sure, we can close this.