Comparison operators do not work with data types other than float in "Expressions".
Bug Report
Steps to Reproduce:
- Open Jupyter Notebook.
- Import Perspective.
- Create a Perspective Table which has a column whose data type is something other than float.
- Create a View with an expression that applies a comparison operator (>, <, >=, <=, ==, !=) on that column.
Expected Result: In the screenshot, I applied the expression which checks whether the value is less than (<) 3 on a column of float64 data type. The comparison operator works with floats. This is what I would expect from the case with integers.

Actual Result: As it can be seen below, the comparison doesn't return the expected result when I try this with integers. Notice that when I refer to the "integers" column instead of "floats", it returns True for each of the values in "integers" even if they are greater than 3.

Environment: perspective-1.0.3 jupyter-notebook : 6.3.0 Python 3.8.8
Additional Context: The modulo operator (%) works fine with integers. There may be some other operators which do not cause any problems. For the moment, it seems like the problem is special to comparison operators, combined with data types other than float.
Thanks for the report @iscanegemen !
This is a known issue, stemming from the fact that several disparate notions of equality in perspective use the same operator overloads that ExprTK does, and are necessarily stricter. Currently all number literals are typed to float on construction, e.g. 3 in your example, and equality/comparison operators check both type and value, which is why the comparison in your second example does not work.
You can work around this for now by casting the integer to the same type with the integer() function:
// Less than 3
if ("integers" < integer(3)) { true } else { false }
... or if you need to, casting the column to a float will also work:
// Less than 3
if (float("integers") < 3) { true } else { false }
We have two under-development features coming up to address this:
- IDE feedback when comparison types do not match
- Full numeric-promotion for comparison/equality/operator types.