mdentropy icon indicating copy to clipboard operation
mdentropy copied to clipboard

Pandas version 0.23 and newer breaks the shuffle function

Open jgpattis opened this issue 3 years ago • 0 comments

Ubuntu 18.04.4 LTS Anaconda python conda version : 4.8.3

python 3.6 # also tried with 3.7 numpy version 1.12.1 # also tried with newer numpy versions pandas version 0.23.4 mdentropy version 0.4.0dev0 sklearn version 0.19.2 scipy version 1.2.1

when calculating dihedral mutual information and using the shuffle function I get the error:

multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/home/name/anaconda3/envs/pd/lib/python3.6/multiprocessing/pool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File "/home/name/anaconda3/envs/pd/lib/python3.6/multiprocessing/pool.py", line 44, in mapstar
    return list(map(*args))
  File "/home/name/anaconda3/envs/pd/lib/python3.6/site-packages/mdentropy-0.4.0.dev0-py3.6.egg/mdentropy/metrics/mutinf.py", line 24, in _partial_mutinf
    self.shuffled_data[j].values,
AttributeError: 'numpy.ndarray' object has no attribute 'values'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "test_mdentropy.py", line 30, in <module>
    M1 = mi.partial_transform(traj, shuffle=1, verbose=True)
  File "/home/name/anaconda3/envs/pd/lib/python3.6/site-packages/mdentropy-0.4.0.dev0-py3.6.egg/mdentropy/metrics/base.py", line 57, in partial_transform
    correction += self._floored_exec()
  File "/home/name/anaconda3/envs/pd/lib/python3.6/site-packages/mdentropy-0.4.0.dev0-py3.6.egg/mdentropy/metrics/base.py", line 32, in _floored_exec
    return floor_threshold(self._exec())
  File "/home/name/anaconda3/envs/pd/lib/python3.6/site-packages/mdentropy-0.4.0.dev0-py3.6.egg/mdentropy/metrics/mutinf.py", line 33, in _exec
    combinations(self.labels, 2))
  File "/home/name/anaconda3/envs/pd/lib/python3.6/multiprocessing/pool.py", line 266, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/home/name/anaconda3/envs/pd/lib/python3.6/multiprocessing/pool.py", line 644, in get
    raise self._value
AttributeError: 'numpy.ndarray' object has no attribute 'values'

Downgrading to pandas 0.22 or lower fixes the problem. Attached is my test script test_mdentropy.py.txt

jgpattis avatar Aug 13 '20 20:08 jgpattis