daft.expressions.Expression.as_py
daft.expressions.Expression.as_py#
- Expression.as_py(type_: type) daft.expressions.AsPyExpression [source]#
Treats every value on the given expression as an object of the specified type. Users can then call methods on this object, which will be translated into a method call on every value on the Expression.
Example
>>> # call .resize(28, 28) on every item in the expression >>> col("images").as_py(Image).resize(28, 28) >>> >>> # get the 0th element of every item in the expression >>> col("tuples").as_py(tuple)[0]
- Parameters
type (Type) – type of each item in the expression
- Returns
A special Expression that records any method calls that a user runs on it, applying the method call to each item in the expression.
- Return type
AsPyExpression