Compute the logarithm
Description
Compute the logarithm
Usage
<Expr>$log(base = exp(1))
Arguments
base
|
Numeric value used as base, defaults to exp(1) .
|
Value
A polars expression
Examples
library("polars")
pl$DataFrame(a = c(1, 2, 4))$
with_columns(
log = pl$col("a")$log(),
log_base_2 = pl$col("a")$log(base = 2)
)
#> shape: (3, 3)
#> ┌─────┬──────────┬────────────┐
#> │ a ┆ log ┆ log_base_2 │
#> │ --- ┆ --- ┆ --- │
#> │ f64 ┆ f64 ┆ f64 │
#> ╞═════╪══════════╪════════════╡
#> │ 1.0 ┆ 0.0 ┆ 0.0 │
#> │ 2.0 ┆ 0.693147 ┆ 1.0 │
#> │ 4.0 ┆ 1.386294 ┆ 2.0 │
#> └─────┴──────────┴────────────┘