I'm trying to use Numexpr to make a filter.when i trying to run the next code snippet:
>>> import pandas as pd
>>> import numexpr
>>> df=pd.DataFrame({'a':[1,2,3],'b':['one','two','three']})
>>> df
a b
0 1 one
1 2 two
2 3 three
>>> a=df.a.values
>>> b=df.b.values
>>> numexpr.evaluate('a<2')
array([ True, False, False])
>>> numexpr.evaluate('b=="one"')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python36-64\lib\site-packages\numexpr\necompiler.py", line 822, in evaluate
zip(names, arguments)]
File "C:\Python36-64\lib\site-packages\numexpr\necompiler.py", line 821, in <listcomp>
signature = [(name, getType(arg)) for (name, arg) in
File "C:\Python36-64\lib\site-packages\numexpr\necompiler.py", line 703, in getType
raise ValueError("unknown type %s" % a.dtype.name)
ValueError: unknown type object
for some reason,i can't use df.eval('b=="one"').Maybe I'm doing it the wrong way. Any help would be appreciated.