Skip to content

Pandas version 0.23 and newer breaks the shuffle function #76

@jgpattis

Description

@jgpattis

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions