
numexpr - issue #92
where() does not work with booleans and strings due to check in numexpr.expressions.commonKind
What steps will reproduce the problem?
a,b,c,d = True, False, "C", "D"
numexpr.evaluate("where(a>b,c,d)")
What is the expected output? What do you see instead?
Expected:
c
A TypeError is raised because int the function numexpr.expressions.commonKind
it is checked whether all nodes are type(str) but of course the first node a>b will always be of type(bool).
I have created a custom dtype and have in the variables c and d a view on these with the dtype=(str,nbytes). I would expect that it just returns the strings of length nbytes.
I am guessing this is not implementable right now due to the fact that you always expect all kinds to be of type str. I have not looked detailed enough into the code to see if there is a solution.
What version of the product are you using? On what operating system?
Using numexpr.version = 2.0.1 from pip install in Ubuntu 11.10.
Status: New
Labels:
Type-Defect
Priority-Medium