`'>' not supported between instances of 'list' and 'int'`
Closed this issue · 3 comments
micycle1 commented
I've just installed version 2.0.3 and experience this error.
import pyEDM
pyEDM.Examples()
leads to
---------------------------------------------------------------------------
RemoteTraceback Traceback (most recent call last)
RemoteTraceback:
"""
Traceback (most recent call last):
File "/usr/local/lib/python3.11/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/multiprocessing/pool.py", line 51, in starmapstar
return list(itertools.starmap(args[0], args[1]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jovyan/.ruffer_kernel/venvs/a7d2aaf5-942b-48fd-bcd6-01a818460e8d/lib/python3.11/site-packages/pyEDM/PoolFunc.py", line 55, in EmbedDimSimplexFunc
df = API.Simplex( dataFrame = data,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jovyan/.ruffer_kernel/venvs/a7d2aaf5-942b-48fd-bcd6-01a818460e8d/lib/python3.11/site-packages/pyEDM/API.py", line 129, in Simplex
S.EmbedData()
File "/home/jovyan/.ruffer_kernel/venvs/a7d2aaf5-942b-48fd-bcd6-01a818460e8d/lib/python3.11/site-packages/pyEDM/EDM.py", line 57, in EmbedData
self.Embedding = pyEDM.API.Embed( dataFrame = self.Data, E = self.E,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jovyan/.ruffer_kernel/venvs/a7d2aaf5-942b-48fd-bcd6-01a818460e8d/lib/python3.11/site-packages/pyEDM/API.py", line 68, in Embed
df = dataFrame[ columns ].shift( periods = shiftVec ).copy()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jovyan/.ruffer_kernel/venvs/a7d2aaf5-942b-48fd-bcd6-01a818460e8d/lib/python3.11/site-packages/pandas/core/frame.py", line 5855, in shift
return super().shift(
^^^^^^^^^^^^^^
File "/home/jovyan/.ruffer_kernel/venvs/a7d2aaf5-942b-48fd-bcd6-01a818460e8d/lib/python3.11/site-packages/pandas/core/generic.py", line 10172, in shift
new_data = self._mgr.shift(
^^^^^^^^^^^^^^^^
File "/home/jovyan/.ruffer_kernel/venvs/a7d2aaf5-942b-48fd-bcd6-01a818460e8d/lib/python3.11/site-packages/pandas/core/internals/managers.py", line 429, in shift
return self.apply("shift", periods=periods, axis=axis, fill_value=fill_value)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jovyan/.ruffer_kernel/venvs/a7d2aaf5-942b-48fd-bcd6-01a818460e8d/lib/python3.11/site-packages/pandas/core/internals/managers.py", line 352, in apply
applied = getattr(b, f)(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jovyan/.ruffer_kernel/venvs/a7d2aaf5-942b-48fd-bcd6-01a818460e8d/lib/python3.11/site-packages/pandas/core/internals/blocks.py", line 1307, in shift
new_values = shift(values, periods, axis, casted)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jovyan/.ruffer_kernel/venvs/a7d2aaf5-942b-48fd-bcd6-01a818460e8d/lib/python3.11/site-packages/pandas/core/array_algos/transforms.py", line 30, in shift
if periods > 0:
^^^^^^^^^^^
TypeError: '>' not supported between instances of 'list' and 'int'
"""
The above exception was the direct cause of the following exception:
TypeError Traceback (most recent call last)
Cell In[24], line 2
1 import pyEDM
----> 2 pyEDM.Examples()
File ~/.ruffer_kernel/venvs/a7d2aaf5-942b-48fd-bcd6-01a818460e8d/lib/python3.11/site-packages/pyEDM/AuxFunc.py:40, in Examples()
36 #---------------------------------------------------------------
37 cmd = str().join(['EmbedDimension( dataFrame = sampleData["TentMap"],',
38 ' columns = "TentMap", target = "TentMap",',
39 ' lib = [1, 100], pred = [201, 500] )'])
---> 40 RunEDM( cmd )
42 #---------------------------------------------------------------
43 cmd = str().join(['PredictInterval( dataFrame = sampleData["TentMap"],',
44 ' columns = "TentMap", target = "TentMap",'
45 ' lib = [1, 100], pred = [201, 500], E = 2 )'])
File ~/.ruffer_kernel/venvs/a7d2aaf5-942b-48fd-bcd6-01a818460e8d/lib/python3.11/site-packages/pyEDM/AuxFunc.py:25, in Examples.<locals>.RunEDM(cmd)
23 print(cmd)
24 print()
---> 25 df = eval( 'EDM.' + cmd )
26 return df
File <string>:1
File ~/.ruffer_kernel/venvs/a7d2aaf5-942b-48fd-bcd6-01a818460e8d/lib/python3.11/site-packages/pyEDM/API.py:426, in EmbedDimension(dataFrame, columns, target, maxE, lib, pred, Tp, tau, exclusionRadius, embedded, validLib, noTime, ignoreNan, verbose, numProcess, showPlot)
424 # Multiargument starmap : EmbedDimSimplexFunc in PoolFunc
425 with Pool( processes = numProcess ) as pool :
--> 426 rhoList = pool.starmap( PoolFunc.EmbedDimSimplexFunc, poolArgs )
428 df = DataFrame( {'E':Evals, 'rho':rhoList} )
430 if showPlot :
File /usr/local/lib/python3.11/multiprocessing/pool.py:375, in Pool.starmap(self, func, iterable, chunksize)
369 def starmap(self, func, iterable, chunksize=None):
370 '''
371 Like `map()` method but the elements of the `iterable` are expected to
372 be iterables as well and will be unpacked as arguments. Hence
373 `func` and (a, b) becomes func(a, b).
374 '''
--> 375 return self._map_async(func, iterable, starmapstar, chunksize).get()
File /usr/local/lib/python3.11/multiprocessing/pool.py:774, in ApplyResult.get(self, timeout)
772 return self._value
773 else:
--> 774 raise self._value
TypeError: '>' not supported between instances of 'list' and 'int'
micycle1 commented
Turns out it's due to having pandas 1.5.3. The library seems to hard require v2+(it could do with having a requirements.txt).
SoftwareLiteracy commented
Thanks for the report and identification!
The pyproject.toml has:
[project]
name = "pyEDM"
requires-python = ">=3.9"
dynamic = ["version"]
dependencies = [ "numpy>=1.23",
"scipy>=1.11",
"scikit-learn>=1.3",
"pandas>=1.5",
"matplotlib>=3.5", ]
Perhaps this needs review. I have tested with latest versions on Linux, but not with legacy versions. Maybe require pandas>=2.0.
SoftwareLiteracy commented
Version 2.1.0 requires pandas >= 2.0.