Loading...

vastorbit.sql.functions.log

vastorbit.sql.functions.log(expr: Annotated[str | list[str] | StringSQL | list[StringSQL], ''], base: int = 10) StringSQL

Logarithm.

Parameters:
  • expr (SQLExpression) – Expression.

  • base (int) – Specifies the base.

Returns:

SQL string.

Return type:

StringSQL

Examples

First, let’s import the VastFrame in order to create a dummy dataset.

from vastorbit import VastFrame

Now, let’s import the vastorbit SQL functions.

import vastorbit.sql.functions as vof

We can now build a dummy dataset.

df = VastFrame({"x": [2, 10, 16, 33]})
df["x"].astype("real")

Now, let’s go ahead and apply the function.

df["log_x"] = vof.log(df["x"])
display(df)
123
x
Double
100%
123
log_x
Double
100%
12.00.30102999566398114
216.01.2041199826559246
310.01.0
433.01.5185139398778873

Note

It’s crucial to utilize vastorbit SQL functions in coding, as they can be updated over time with new syntax. While SQL functions typically remain stable, they may vary across platforms or versions. vastorbit effectively manages these changes, a task not achievable with pure SQL.

See also

VastFrame.eval() : Evaluates the expression.