FExpr is a class that encapsulates computations to be done on a frame.

FExpr objects are rarely constructed directly (though it is possible too), instead they are more commonly created as inputs/outputs from various functions in datatable.

Consider the following example:

math.sin(2 * f.Angle)

Here accessing column “Angle” in namespace f creates an FExpr object. Multiplying this FExpr by a python scalar 2 creates a new FExpr. And finally, applying the sine function creates yet another FExpr. The resulting expression can be applied to a frame via the DT[i, j] method, which will compute that expression using the data of that particular frame.

Thus, an FExpr is a stored computation, which can later be applied to a Frame, or to multiple frames.

Because of its delayed nature, an FExpr checks its correctness at the time when it is applied to a frame, not sooner. In particular, it is possible for the same expression to work on one frame, but fail on another. In the example above, the expression may raise an error if there is no column named “Angle” in the frame, or if the column exists but has non-numeric type.

Most functions in datatable that accept an FExpr as an input, return a new FExpr as an output, thus creating a tree of FExprs as the resulting evaluation graph.

Also, all functions that accept FExprs as arguments, will also accept certain other python types as an input, essentially converting them into FExprs. Hence, we will sometimes say that a function accepts FExpr-like objects as arguments.

All binary operators op(x, y) listed below work when either x or y, or both are FExprs.



Create an FExpr.


Assign new names to the columns from the FExpr.


Append another FExpr.


Remove columns from the FExpr.

Arithmeritc operators

__add__(x, y)

Addition x + y.

__sub__(x,  y)

Subtraction x - y.

__mul__(x, y)

Multiplication x * y.

__truediv__(x, y)

Division x / y.

__floordiv__(x, y)

Integer division x // y.

__mod__(x, y)

Modulus x % y (the remainder after integer division).

__pow__(x, y)

Power x ** y.


Unary plus +x.


Unary minus -x.

Bitwise operators

__and__(x, y)

Bitwise AND x & y.

__or__(x, y)

Bitwise OR x | y.

__xor__(x, y)

Bitwise XOR x ^ y.


Bitwise NOT ~x.

__lshift__(x, y)

Left shift x << y.

__rshift__(x, y)

Right shift x >> y.

Relational operators

__eq__(x, y)

Equal x == y.

__ne__(x, y)

Not equal x != y.

__lt__(x, y)

Less than x < y.

__le__(x, y)

Less than or equal x <= y.

__gt__(x, y)

Greater than x > y.

__ge__(x, y)

Greater than or equal x >= y.

Equivalents of base datatable functions



Implicitly convert FExpr into a boolean value.


Apply slice to a string column.


Used by Python function repr().


String length.


Check whether the string column matches a pattern.