You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For Python 3.6 the above code runs. For Python 3.7 it errors-out with "TypeError: unhashable type: 'numpy.ndarray'". If I am returning the wrong type (an array instead of a named series or dataframe) I apologize.
Expected Output
For Python 3.6 we get what I expected:
array([1, 4])
For Python 3.7 0.25.1 pandas we get the following:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/johnmount/opt/anaconda3/lib/python3.7/site-packages/pandas/core/frame.py", line 3300, in eval
return _eval(expr, inplace=inplace, **kwargs)
File "/Users/johnmount/opt/anaconda3/lib/python3.7/site-packages/pandas/core/computation/eval.py", line 327, in eval
ret = eng_inst.evaluate()
File "/Users/johnmount/opt/anaconda3/lib/python3.7/site-packages/pandas/core/computation/engines.py", line 70, in evaluate
res = self._evaluate()
File "/Users/johnmount/opt/anaconda3/lib/python3.7/site-packages/pandas/core/computation/engines.py", line 118, in _evaluate
_check_ne_builtin_clash(self.expr)
File "/Users/johnmount/opt/anaconda3/lib/python3.7/site-packages/pandas/core/computation/engines.py", line 27, in _check_ne_builtin_clash
names = expr.names
File "/Users/johnmount/opt/anaconda3/lib/python3.7/site-packages/pandas/core/computation/expr.py", line 850, in names
return frozenset([self.terms.name])
TypeError: unhashable type: 'numpy.ndarray'
Note: both failing and successful runs are using Pandas 0.25.1 and numpy 1.17.2.
Edit: Pandas 0.25.3 with Python 3.7.5, numpy 1.17.3 works fine. My question then is: is there a work around for when we are using Pandas 0.25.1?
The text was updated successfully, but these errors were encountered:
JohnMount
changed the title
pandas.DatatFrame.eval() erroring-out on Python 3.7 (but not Python 3.6)
pandas.core.frame.DataFrame.eval() erroring-out on Python 3.7 (but not Python 3.6)
Nov 23, 2019
JohnMount
changed the title
pandas.core.frame.DataFrame.eval() erroring-out on Python 3.7 (but not Python 3.6)
pandas.core.frame.DataFrame.eval() erroring-out on Python 3.7 (but not on Python 3.6)
Nov 23, 2019
JohnMount
changed the title
pandas.core.frame.DataFrame.eval() erroring-out on Python 3.7 (but not on Python 3.6)
0.25.1 pandas.core.frame.DataFrame.eval() erroring-out on Python 3.7 (but not on Python 3.6)
Nov 23, 2019
Code Sample
Problem description
For Python 3.6 the above code runs. For Python 3.7 it errors-out with "
TypeError: unhashable type: 'numpy.ndarray'
". If I am returning the wrong type (an array instead of a named series or dataframe) I apologize.Expected Output
For Python 3.6 we get what I expected:
array([1, 4])
For Python 3.7 0.25.1 pandas we get the following:
Note: both failing and successful runs are using Pandas
0.25.1
and numpy1.17.2
.Edit: Pandas
0.25.3
with Python3.7.5
, numpy1.17.3
works fine. My question then is: is there a work around for when we are using Pandas0.25.1
?Output of
pd.show_versions()
Working version:
Failing version:
The text was updated successfully, but these errors were encountered: