Numeric
- Expr.abs() Expr
- Categories:
numeric
Return the abso lute value of the expression.
- Expr.add(
- other: Any,
- Categories:
numeric
Equivalent to the + operator.
For numeric types adds the given input. For string types concatenates the given input.
- Parameters:
other – The value to add or concatenate.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf.select(td.col("val"), td.col("val").add(1).alias("add")) >>> ┌──────┬──────────┐ │ val ┆ add │ │ --- ┆ --- │ │ i64 ┆ i64 │ ╞══════╪══════════╡ │ 1 ┆ 2 │ │ 15 ┆ 16 │ │ 18 ┆ 19 │ │ 60 ┆ 61 │ │ 60 ┆ 61 │ │ 75 ┆ 76 │ │ null ┆ null │ └──────┴──────────┘
- Expr.arccos() Expr
- Categories:
numeric
Calculate the inverse cosine of the element value.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf = tf.select(td.col("val"), td.col("val").arccos().alias("arccos")) >>> ┌──────┬──────────┐ │ val ┆ arccos │ │ --- ┆ --- │ │ f64 ┆ f64 │ ╞══════╪══════════╡ │ 0.01 ┆ 1.560796 │ │ 0.15 ┆ 1.420228 │ │ 0.18 ┆ 1.38981 │ │ 0.6 ┆ 0.927295 │ │ 0.6 ┆ 0.927295 │ │ 0.75 ┆ 0.722734 │ │ null ┆ null │ └──────┴──────────┘
- Expr.arccosh() Expr
- Categories:
numeric
Calculate the inverse hyperbolic cosine of the element value.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf = tf.select(td.col("val"), td.col("val").arccosh().alias("arccosh")) >>> ┌──────┬──────────┐ │ val ┆ arccosh │ │ --- ┆ --- │ │ f64 ┆ f64 │ ╞══════╪══════════╡ │ 0.1 ┆ NaN │ │ 1.5 ┆ 0.962424 │ │ 1.8 ┆ 1.192911 │ │ 6.0 ┆ 2.477889 │ │ 6.0 ┆ 2.477889 │ │ 7.5 ┆ 2.703576 │ │ null ┆ null │ └──────┴──────────┘
- Expr.arcsin() Expr
- Categories:
numeric
Calculate the inverse sine of the element value.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf = tf.select(td.col("val"), td.col("val").arcsin().alias("arcsin")) >>> ┌──────┬──────────┐ │ val ┆ arcsin │ │ --- ┆ --- │ │ f64 ┆ f64 │ ╞══════╪══════════╡ │ 0.01 ┆ 0.01 │ │ 0.15 ┆ 0.150568 │ │ 0.18 ┆ 0.180986 │ │ 0.6 ┆ 0.643501 │ │ 0.6 ┆ 0.643501 │ │ 0.75 ┆ 0.848062 │ │ null ┆ null │ └──────┴──────────┘
- Expr.arcsinh() Expr
- Categories:
numeric
Calculate the inverse hyperbolic sine of the element value.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf = tf.select(td.col("val"), td.col("val").arcsinh().alias("arcsinh")) >>> ┌──────┬──────────┐ │ val ┆ arcsinh │ │ --- ┆ --- │ │ f64 ┆ f64 │ ╞══════╪══════════╡ │ 0.1 ┆ 0.099834 │ │ 1.5 ┆ 1.194763 │ │ 1.8 ┆ 1.350441 │ │ 6.0 ┆ 2.49178 │ │ 6.0 ┆ 2.49178 │ │ 7.5 ┆ 2.712465 │ │ null ┆ null │ └──────┴──────────┘
- Expr.arctan() Expr
- Categories:
numeric
Calculate the inverse tangent of the element value.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf = tf.select(td.col("val"), , td.col("val").arctan().alias("arctan")) >>> ┌──────┬──────────┐ │ val ┆ arctan │ │ --- ┆ --- │ │ f64 ┆ f64 │ ╞══════╪══════════╡ │ 0.01 ┆ 0.01 │ │ 0.15 ┆ 0.14889 │ │ 0.18 ┆ 0.178093 │ │ 0.6 ┆ 0.54042 │ │ 0.6 ┆ 0.54042 │ │ 0.75 ┆ 0.643501 │ │ null ┆ null │ └──────┴──────────┘
- Expr.arctanh() Expr
- Categories:
numeric
Calculate the inverse hyperbolic tangent of the element value.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf = tf.select(td.col("val"), , td.col("val").arctanh().alias("arctanh")) >>> ┌──────┬──────────┐ │ val ┆ arctanh │ │ --- ┆ --- │ │ f64 ┆ f64 │ ╞══════╪══════════╡ │ 0.01 ┆ 0.01 │ │ 0.15 ┆ 0.15114 │ │ 0.18 ┆ 0.181983 │ │ 0.6 ┆ 0.693147 │ │ 0.6 ┆ 0.693147 │ │ 0.75 ┆ 0.972955 │ │ null ┆ null │ └──────┴──────────┘
- Expr.cbrt() Expr
- Categories:
numeric
Calculate the cub root of the element value.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf = tf.select(td.col("val"), td.col("val").cbrt().alias("cbrt")) >>> ┌──────┬──────────┐ │ val ┆ cbrt │ │ --- ┆ --- │ │ i64 ┆ f64 │ ╞══════╪══════════╡ │ 1 ┆ 1.0 │ │ 15 ┆ 2.466212 │ │ 18 ┆ 2.620741 │ │ 60 ┆ 3.914868 │ │ 60 ┆ 3.914868 │ │ 75 ┆ 4.217163 │ │ null ┆ null │ └──────┴──────────┘
- Expr.ceil() Expr
- Categories:
numeric
Round up the expression to the next integer value.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf = tf.select(td.col("temp"), td.col("temp").first().ceil().alias("ceil")) >>> ┌──────┬─────────┐ │ temp ┆ ceil │ │ --- ┆ ------- │ │ f64 ┆ f64 │ ╞══════╪═════════╡ │ 1.0 ┆ 1.0 │ │ 1.1 ┆ 2.0 │ └──────┴─────────┘
- Expr.clip(
- lower_bound: int | float | Decimal | date | time | datetime | timedelta | Expr | Series | str | None = None,
- upper_bound: int | float | Decimal | date | time | datetime | timedelta | Expr | Series | str | None = None,
- Categories:
numeric
For element values outside the lower and upper bounds, lower values are replaced with the lower bound and upper values with the upper bound. Values within the lower and upper bounds are unaffected.
- Parameters:
lower_bound – The lower bound value. If None, the lower bound is not set.
upper_bound – The upper bound value. If None, the upper bound is
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf = tf.select(td.col("age"), td.col("age").clip(18,65).alias("clip")) >>> ┌──────┬─────────┐ │ age ┆ clip │ │ --- ┆ ------- │ │ i64 ┆ i64 │ ╞══════╪═══+++═══╡ │ 1 ┆ 18 │ │ 18 ┆ 18 │ │ 50 ┆ 50 │ │ 65 ┆ 65 │ │ 70 ┆ 65 │ └──────┴─────────┘
- Expr.cos() Expr
- Categories:
numeric
Calculate the cosine of the element value.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf = tf.select(td.col("val"), td.col("val").cos().alias("cos")) >>> ┌──────┬───────────┐ │ val ┆ cos │ │ --- ┆ --- │ │ f64 ┆ f64 │ ╞══════╪═══════════╡ │ 0.1 ┆ 0.995004 │ │ 1.5 ┆ 0.070737 │ │ 1.8 ┆ -0.227202 │ │ 6.0 ┆ 0.96017 │ │ 6.0 ┆ 0.96017 │ │ 7.5 ┆ 0.346635 │ │ null ┆ null │ └──────┴───────────┘
- Expr.cosh() Expr
- Categories:
numeric
Calculate the hyperbolic cosine of the element value.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf = tf.select(td.col("val"), td.col("val").cosh().alias("cosh")) >>> ┌──────┬────────────┐ │ val ┆ cosh │ │ --- ┆ --- │ │ f64 ┆ f64 │ ╞══════╪════════════╡ │ 0.1 ┆ 1.005004 │ │ 1.5 ┆ 2.35241 │ │ 1.8 ┆ 3.107473 │ │ 6.0 ┆ 201.715636 │ │ 6.0 ┆ 201.715636 │ │ 7.5 ┆ 904.021484 │ │ null ┆ null │ └──────┴────────────┘
- Expr.cot() Expr
- Categories:
numeric
Calculate the cotangent of the element value.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf = tf.select(td.col("val"), td.col("val").cot().alias("cot")) >>> ┌──────┬───────────┐ │ val ┆ cot │ │ --- ┆ --- │ │ f64 ┆ f64 │ ╞══════╪═══════════╡ │ 0.1 ┆ 9.966644 │ │ 1.5 ┆ 0.070915 │ │ 1.8 ┆ -0.233304 │ │ 6.0 ┆ -3.436353 │ │ 6.0 ┆ -3.436353 │ │ 7.5 ┆ 0.369547 │ │ null ┆ null │ └──────┴───────────┘
- Expr.degrees() Expr
- Categories:
numeric
Convert a radian value to degrees
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf = tf.select(td.col("val"), td.col("val").degrees().alias("degrees")) >>> ┌──────┬────────────┐ │ val ┆ degress │ │ --- ┆ --- │ │ f64 ┆ f64 │ ╞══════╪════════════╡ │ 0.1 ┆ 5.729578 │ │ 1.5 ┆ 85.943669 │ │ 1.8 ┆ 103.132403 │ │ 6.0 ┆ 343.774677 │ │ 6.0 ┆ 343.774677 │ │ 7.5 ┆ 429.718346 │ │ null ┆ null │ └──────┴────────────┘
- Expr.diff(
- n: int = 1,
- Categories:
numeric
Compute the difference between an element value and the element value of the specified relative row.
It supports numberic and datetime types.
- Parameters:
n – The relative row to compute the difference with. Defaults to 1 (previous). Use a negative number to get a next row.
Examples:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf.select(td.col("i"), td.col("i").diff().diff().alias("diff")) >>> ┌──────┬──────┐ │ i ┆ diff │ │ --- ┆ --- │ │ i64 ┆ i64 │ ╞══════╪══════╡ │ 1 ┆ null │ │ 0 ┆ -1 │ │ 2 ┆ 2 │ │ 3 ┆ 1 │ │ 4 ┆ 1 │ │ -1 ┆ -5 │ │ -2 ┆ -1 │ │ -3 ┆ -1 │ │ -4 ┆ -1 │ │ -5 ┆ -1 │ │ null ┆ null │ └──────┴──────┘
- Expr.exp() Expr
- Categories:
numeric
Calculate the exponential of the element value.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf = tf.select(td.col("val"), td.col("val").exp().alias("exp")) >>> ┌──────┬─────────────┐ │ val ┆ exp │ │ --- ┆ --- │ │ f64 ┆ f64 │ ╞══════╪═════════════╡ │ 0.1 ┆ 1.105171 │ │ 6.0 ┆ 403.428793 │ │ 6.0 ┆ 403.428793 │ │ 7.5 ┆ 1808.042414 │ │ null ┆ null │ └──────┴─────────────┘
- Expr.floor() Expr
- Categories:
numeric
Round down the expression to the previous integer value.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf = tf.select(td.col("temp"), td.col("temp").ceil().alias("floor")) >>> ┌──────┬─────────┐ │ temp ┆ floor │ │ --- ┆ ------- │ │ f64 ┆ i64 │ ╞══════╪═════════╡ │ 1.0 ┆ 1 │ │ 1.1 ┆ 1 │ └──────┴─────────┘
- Expr.hash( ) Expr
- Categories:
numeric
Compute the hash of an element value.
- Parameters:
seed – The seed for the hash function.
seed_1 – The first seed for the hash function.
seed_2 – The second seed for the hash function.
seed_3 – The third seed for the hash function.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf = tf.select(td.col("temp"), td.col("temp").hash(5).alias("hash")) >>> ┌──────┬─────────────────────┐ │ temp ┆ hash │ │ --- ┆ --- │ │ f64 ┆ u64 │ ╞══════╪═════════════════════╡ │ 1.1 ┆ 1438840365631752616 │ │ 2.0 ┆ 4738789230185236462 │ └──────┴─────────────────────┘
- Expr.log(
- base: float = 2.718281828459045,
- Categories:
numeric
Calculate the logarithm to the given base.
- Parameters:
base – logarithm base, defaults to e.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf = tf.select(td.col("val"), td.col("val").log().alias("log") >>> ┌──────┬──────────┐ │ val ┆ log │ │ --- ┆ --- │ │ f64 ┆ f64 │ ╞══════╪══════════╡ │ -1.0 ┆ NaN │ │ 0.0 ┆ -inf │ │ 1.1 ┆ 0.09531 │ │ 2.0 ┆ 0.693147 │ │ inf ┆ inf │ │ null ┆ null │ │ NaN ┆ NaN │ └──────┴──────────┘
- Expr.log10() Expr
- Categories:
numeric
Calculate the logarithm base 10.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf = tf.select(td.col("val"), td.col("val").log10().alias("log10") >>> ┌──────┬──────────┐ │ val ┆ log10 │ │ --- ┆ --- │ │ f64 ┆ f64 │ ╞══════╪══════════╡ │ -1.0 ┆ NaN │ │ 0.0 ┆ -inf │ │ 1.1 ┆ 0.041393 │ │ 2.0 ┆ 0.30103 │ │ inf ┆ inf │ │ null ┆ null │ │ NaN ┆ NaN │ └──────┴──────────┘
- Expr.log1p() Expr
- Categories:
numeric
Calculate the natural logarithm plus one.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf = tf.select(td.col("val"), td.col("val").log1p().alias("log1p") >>> ┌──────┬──────────┐ │ val ┆ log1p │ │ --- ┆ --- │ │ f64 ┆ f64 │ ╞══════╪══════════╡ │ -1.0 ┆ -inf │ │ 0.0 ┆ 0.0 │ │ 1.1 ┆ 0.741937 │ │ 2.0 ┆ 1.098612 │ │ inf ┆ inf │ │ null ┆ null │ │ NaN ┆ NaN │ └──────┴──────────┘
- Expr.mod(
- other: Any,
- Categories:
numeric
Modulus operator.
- Parameters:
other – The value to divide by.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf = tf.select(td.col("val"), td.col("val").mod(5).alias("mod")) >>> ┌──────┬──────┐ │ val ┆ mod │ │ --- ┆ --- │ │ i64 ┆ i64 │ ╞══════╪══════╡ │ 1 ┆ 1 │ │ 15 ┆ 0 │ │ 18 ┆ 3 │ │ null ┆ null │ └──────┴──────┘
- Expr.mul(
- other: Any,
- Categories:
numeric
Multiplication operator.
- Parameters:
other – The value to multiply by.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf = tf.select(td.col("val"), td.col("val").mul(10).alias("mul")) >>> ┌──────┬──────┐ │ val ┆ mul │ │ --- ┆ --- │ │ i64 ┆ i64 │ ╞══════╪══════╡ │ 1 ┆ 10 │ │ 15 ┆ 150 │ │ 18 ┆ 180 │ │ 75 ┆ 750 │ │ null ┆ null │ └──────┴──────┘
- Expr.neg() Expr
- Categories:
numeric
Unary minus operator.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf = tf.select(td.col("val"), td.col("val").neg().alias("neg")) >>> ┌──────┬──────┐ │ val ┆ neg │ │ --- ┆ --- │ │ f64 ┆ f64 │ ╞══════╪══════╡ │ -1.0 ┆ 1.0 │ │ 0.0 ┆ -0.0 │ │ 1.1 ┆ -1.1 │ │ 2.0 ┆ -2.0 │ │ inf ┆ -inf │ │ null ┆ null │ │ NaN ┆ NaN │ └──────┴──────┘
- Expr.pow( ) Expr
- Categories:
numeric
Exponentiation operator.
- Parameters:
exponent – exponent value.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf = tf.select(td.col("val"), td.col("val").pow(2).alias("pow")) >>> ┌──────┬──────┐ │ age ┆ pow │ │ --- ┆ --- │ │ i64 ┆ i64 │ ╞══════╪══════╡ │ 1 ┆ 1 │ │ 15 ┆ 225 │ │ 18 ┆ 324 │ │ 60 ┆ 3600 │ │ null ┆ null │ └──────┴──────┘
- Expr.radians() Expr
- Categories:
numeric
Convert a degree value to radians
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf = tf.select(td.col("val"), td.col("val").radians().alias("radians")) >>> ┌─────────┬──────────┐ │ val ┆ radians │ │ --- ┆ --- │ │ i64 ┆ f64 │ ╞═════════╪══════════╡ │ 1 ┆ 0.017453 │ │ 15 ┆ 0.261799 │ │ 60 ┆ 1.047198 │ │ 75 ┆ 1.308997 │ │ null ┆ null │ └─────────┴──────────┘
- Expr.reinterpret(
- *,
- signed: bool = True,
- Categories:
numeric
Reinterpret the 64bit element values (i64 or u64) as a signed/unsigned integers. Only valid for 64bit integers, for other types use cast.
- Parameters:
signed – true to convert to i64, false to convert to u64. This named argument must be specified.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf.select(td.col("val"), td.col("val") >>> .reinterpret(signed=False).alias("reinterpret")) >>> ┌──────┬─────────────┐ │ val ┆ reinterpret │ │ --- ┆ --- │ │ i64 ┆ u64 │ ╞══════╪═════════════╡ │ 3 ┆ 3 │ │ 1 ┆ 1 │ │ 5 ┆ 5 │ │ 4 ┆ 4 │ │ 2 ┆ 2 │ │ 6 ┆ 6 │ │ null ┆ null │ └──────┴─────────────┘
- Expr.round(
- decimals: int = 0,
- Categories:
numeric
Round floating point element values.
- Parameters:
decimals – number of decimal places to round to.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf.select(td.col("val"), td.col("val").round().alias("round")) >>> ┌──────┬───────┐ │ val ┆ round │ │ --- ┆ --- │ │ f64 ┆ f64 │ ╞══════╪═══════╡ │ -1.0 ┆ -1.0 │ │ 0.0 ┆ 0.0 │ │ 1.1 ┆ 1.0 │ │ 2.0 ┆ 2.0 │ │ inf ┆ inf │ │ null ┆ null │ │ NaN ┆ NaN │ └──────┴───────┘
- Expr.round_sig_figs(
- digits: int,
- Categories:
numeric
Round floating point element values to the specified significant figures.
- Parameters:
digits – number of digits to round up.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf.select(td.col("val"), td.col("val").round_sig_figs(2) >>> .alias("round_sig_figs")) >>> ┌────────┬────────────────┐ │ val ┆ round_sig_figs │ │ --- ┆ --- │ │ f64 ┆ f64 │ ╞════════╪════════════════╡ │ 0.0123 ┆ 0.012 │ │ 2.0244 ┆ 2.0 │ │ 0.0 ┆ 0.0 │ │ inf ┆ NaN │ │ 50.0 ┆ 50.0 │ │ 1.0 ┆ 1.0 │ │ NaN ┆ NaN │ │ null ┆ null │ │ 112.0 ┆ 110.0 │ │ 2142.0 ┆ 2100.0 │ └────────┴────────────────┘
- Expr.shrink_dtype() Expr
- Categories:
numeric
Cast down a column to the smallest type that can hold the element values.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf.select(td.col("val"), td.col("val").shrink_dtype() >>> .alias("shrink_dtype")) >>> ┌───────┬──────────────┐ │ val ┆ shrink_dtype │ │ --- ┆ --- │ │ i64 ┆ i32 │ ╞═══════╪══════════════╡ │ 0 ┆ 0 │ │ 256 ┆ 256 │ │ 65025 ┆ 65025 │ └───────┴──────────────┘
- Expr.sign() Expr
- Categories:
numeric
Calculate the sign of element values.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf.select(td.col("val"), td.col("val").sign().alias("sign")) >>> ┌────────┬──────┐ │ val ┆ sign │ │ --- ┆ --- │ │ f64 ┆ f64 │ ╞════════╪══════╡ │ 0.0123 ┆ 1.0 │ │ 2.0244 ┆ 1.0 │ │ 0.0 ┆ 0.0 │ │ inf ┆ 1.0 │ │ -50.0 ┆ -1.0 │ │ 1.0 ┆ 1.0 │ │ NaN ┆ NaN │ │ null ┆ null │ │ -112.0 ┆ -1.0 │ │ 2142.0 ┆ 1.0 │ └────────┴──────┘
- Expr.sin() Expr
- Categories:
numeric
Calculate the sine of the element value.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf.select(td.col("val"), td.col("val").sin().alias("sin")) >>> ┌─────┬───────────┐ │ val ┆ sin │ │ --- ┆ --- │ │ i64 ┆ f64 │ ╞═════╪═══════════╡ │ 0 ┆ 0.0 │ │ 30 ┆ -0.988032 │ │ 60 ┆ -0.304811 │ │ 90 ┆ 0.893997 │ └─────┴───────────┘
- Expr.sinh() Expr
- Categories:
numeric
Calculate the hyperbolic sine of the element value.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf.select(td.col("val"), td.col("val").sinh().alias("sinh")) >>> ┌─────┬───────────┐ │ val ┆ sinh │ │ --- ┆ --- │ │ i64 ┆ f64 │ ╞═════╪═══════════╡ │ 0 ┆ 0.0 │ │ 30 ┆ 5.3432e12 │ │ 60 ┆ 5.7100e25 │ │ 90 ┆ 6.1020e38 │ └─────┴───────────┘
- Expr.sqrt() Expr
- Categories:
numeric
Calculate the square root of the element value.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf.select(td.col("val"), td.col("val").sqrt().alias("sqrt")) >>> ┌──────┬──────────┐ │ val ┆ sqrt │ │ --- ┆ --- │ │ f64 ┆ f64 │ ╞══════╪══════════╡ │ 1.0 ┆ 1.0 │ │ 2.0 ┆ 1.414214 │ │ NaN ┆ NaN │ │ 4.0 ┆ 2.0 │ │ 5.0 ┆ 2.236068 │ │ null ┆ null │ └──────┴──────────┘
- Expr.sub(
- other: Any,
- Categories:
numeric
Equivalent to the - operator.
- Parameters:
other – value to subtract.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf.select(td.col("val"), td.col("val").sub(1).alias("sub")) >>> ┌──────┬──────────┐ │ val ┆ sub │ │ --- ┆ --- │ │ i64 ┆ i64 │ ╞══════╪══════════╡ │ 1 ┆ 0 │ │ 15 ┆ 14 │ │ 18 ┆ 17 │ │ 60 ┆ 59 │ │ 60 ┆ 59 │ │ 75 ┆ 74 │ │ null ┆ null │ └──────┴──────────┘
- Expr.tan() Expr
- Categories:
numeric
Calculate the tangent of the element value.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf.select(td.col("val"), td.col("val").tan().alias("tan")) >>> ┌─────┬───────────┐ │ val ┆ tan │ │ --- ┆ --- │ │ i64 ┆ f64 │ ╞═════╪═══════════╡ │ 0 ┆ 0.0 │ │ 30 ┆ -6.405331 │ │ 60 ┆ 0.32004 │ │ 90 ┆ -1.9952 │ └─────┴───────────┘
- Expr.tanh() Expr
- Categories:
numeric
Calculate the hyperbolic tangent of the element value.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf.select(td.col("val"), td.col("val").tanh().alias("tanh")) >>> ┌─────┬──────────┐ │ val ┆ tanh │ │ --- ┆ --- │ │ f64 ┆ f64 │ ╞═════╪══════════╡ │ 0.0 ┆ 0.0 │ │ 3.0 ┆ 0.995055 │ │ 6.0 ┆ 0.999988 │ │ 9.0 ┆ 1.0 │ └─────┴──────────┘
- Expr.truediv(
- other: Any,
- Categories:
numeric
Equivalent to the float / operator.
- Parameters:
other – value to divide by.
Example:
>>> import tabsdata as td >>> >>> tf: td.TableFrame ... >>> >>> tf.select(td.col("val"), td.col("val").truediv(3).alias("truediv")) >>> ┌────────┬────────────┐ │ val ┆ truediv │ │ --- ┆ --- │ │ f64 ┆ f64 │ ╞════════╪════════════╡ │ 0.0123 ┆ 0.0041 │ │ 2.0244 ┆ 0.6748 │ │ 0.0 ┆ 0.0 │ │ inf ┆ inf │ │ -50.0 ┆ -16.666667 │ │ 1.0 ┆ 0.333333 │ │ NaN ┆ NaN │ │ null ┆ null │ │ -112.0 ┆ -37.333333 │ │ 2142.0 ┆ 714.0 │ └────────┴────────────┘