emzed.table.expressions module¶
- class emzed.table.expressions.Apply(model, function, args, ignore_nones)[source]¶
Bases:
Expression
- class emzed.table.expressions.ColumnAccessor(model, col_name, col_type, db_col_name, access_name)[source]¶
Bases:
Expression
- class emzed.table.expressions.Expression[source]¶
Bases:
ABC
- compatible_with_sql_update = True¶
- contains(other)[source]¶
Column expression to evaluate if value contains the specified string, element-wise.
: param: other: String defining search sequence.
- endswith(other)[source]¶
Column expression to evaluate if value ends with the specified postfix, element-wise.
: param: other: str defining postfix
- floor()[source]¶
Return the floor of the column values, element-wise.
Example:
a float ----- -1.70 -1.50 -0.20 0.20 1.50 1.70 2.00
t.add_column('b ', t.a.floor(), float)
results
a b float float ----- ----- -1.70 -1.00 -1.50 -1.00 -0.20 0.00 0.20 0.00 1.50 1.00 1.70 1.00 2.00 2.00
see also
max()
.
- is_none()[source]¶
expression to evaluate
None
values in column.Since
==
operation is not possible withNone
it replaces Python expressionif value is None:
Example: .. code-block:: python
t.replace_column(t.a.is_none().then_else(1e-10, t.a), float)
- is_not_none()[source]¶
Column expression to evaluate values different from
None
.Since
!=
operation is not possible withNone
it replaces Python expressionif value is not None:
.Example:
t1 = t.filter(t.a.is_not_none())
- max()[source]¶
table.column expression
evaluating column to its maximal value.Examples: Given table t
a float ----- 2.00 4.30 1.50
t.add_column(‘b ‘, t.a.max(), float)
results
a b float float ----- ----- 2.00 4.30 4.30 4.30 1.50 4.30
and
t.a.max().eval() == max(t.a) == 4.3
- min()[source]¶
table.column expression
evaluating column to its minimal value, element-wise.Use analogous to
max()
.
- round(digits=0)[source]¶
expression to round column values to the given number of
digits
, element-wise.- Parameters:
digits – Number of digits applied for rounding.
Use analogous to
max()
.
- startswith(other)[source]¶
Column expression to evaluate if value starts with the specified prefix, element-wise.
: param: other: str defining prefix
Example: .. parsed-literal:
a str --------- hello hey you, hey?
t.add_column('b ', t.a.startswith('he'), bool)
results
a b str bool --------- ----- hello True hey True you, hey? False
- then_else(then, else_)[source]¶
expression to perform
if then else
operations on Table Column.- Parameters:
then – column or value returned if condition is
True
.else – column or value returned if condition is
False
.
Examples: 1) .. parsed-literal:
a float ----- 2.00 4.30 1.50
t.add_column(‘b ‘, (t.a>2).then_else(t.a, -1.0), float)
results:
a b float float ----- ----- 2.00 -1.00 4.30 4.30 1.50 -1.00
a bool ----- True False True
t.add_column('b ', t.a.then_else('green', 'red'), str)
retults:
a b bool str —– —– True green False red True green
- class emzed.table.expressions.FunctionWrapper(function, model, ignore_nones, args)[source]¶
Bases:
object
- class emzed.table.expressions.IsIn(expression, values)[source]¶
Bases:
Expression
- class emzed.table.expressions.Lookup(left_key, right_key, right_value)[source]¶
Bases:
Expression
- class emzed.table.expressions.NonAlgebraicColumnAccessor(model, col_name, col_type, db_col_name, access_name)[source]¶
Bases:
ColumnAccessor
- class emzed.table.expressions.Predicate(expression, sql_term)[source]¶
Bases:
Expression
- class emzed.table.expressions.ThenElse(condition, then, else_)[source]¶
Bases:
Expression
- class emzed.table.expressions.Unary(expression, name, sql_template)[source]¶
Bases:
Expression
- class emzed.table.expressions.Value(value)[source]¶
Bases:
Expression