Expr.is_between
methodView source ↗
def is_between(
lower_bound: IntoTdExpr,
upper_bound: IntoTdExpr,
closed: ClosedInterval = 'both',
) -> TdExpr
Categories: logic
If an expression is between the given bounds.
Parameters
parameter
lower_boundThe lower bound value.
parameter
upper_boundThe upper bound value.
parameter
closedThe interval type, either "both", "left", "right", or "neither"
Examples
>>> import tabsdata as td
>>>
>>> tf: td.TableFrame ...
>>>
>>> tf = tf.select(td.col("temp"), td.col("temp")
>>> .is_between(0, 1).alias("between"))
>>>
┌──────┬─────────┐
│ temp ┆ between │
│ --- ┆ ------- │
│ f64 ┆ bool │
╞══════╪═════════╡
│-1.0 ┆ false │
│ 0.0 ┆ true │
│ 0.5 ┆ true │
│ 1.0 ┆ true │
│ 1.1 ┆ false │
└──────┴─────────┘