Skip to content

daft.functions.var#

var #

var(expr: Expression, ddof: int = 1) -> Expression

Calculates the variance of the values in the expression.

Parameters:

Name Type Description Default
expr Expression

The input expression to calculate variance for.

required
ddof int

Delta degrees of freedom. The divisor used in calculations is N - ddof, where N is the number of non-null elements. Defaults to 1 (sample variance).

1

Returns:

Type Description
Expression

Expression representing the variance.

Source code in daft/functions/agg.py
183
184
185
186
187
188
189
190
191
192
193
194
195
def var(expr: Expression, ddof: int = 1) -> Expression:
    """Calculates the variance of the values in the expression.

    Args:
        expr: The input expression to calculate variance for.
        ddof: Delta degrees of freedom. The divisor used in calculations
            is N - ddof, where N is the number of non-null elements.
            Defaults to 1 (sample variance).

    Returns:
        Expression representing the variance.
    """
    return Expression._from_pyexpr(expr._expr.var(ddof))