Skip to main content

CovarPop

This class calculates the population or sample covariance between two numeric expressions. It allows for optional filtering of input rows and provides a mechanism to specify a default value when no data is available.

Attributes

AttributeTypeDescription
functionstringThe SQL aggregate function name used for calculation, determined by whether the covariance is for a sample or a population.

Constructor

Signature

def CovarPop(
y: Any,
x: Any,
sample: boolean = False,
filter: Any = None,
default: Any = None
) - > null

Parameters

NameTypeDescription
yAnyThe dependent variable or first expression for covariance calculation.
xAnyThe independent variable or second expression for covariance calculation.
sampleboolean = FalseIf True, uses COVAR_SAMP; otherwise, uses COVAR_POP.
filterAny = NoneAn optional filter expression to limit the rows included in the aggregate.
defaultAny = NoneThe default value to return if no rows are aggregated.

Signature

def CovarPop(
y: expression,
x: expression,
sample: boolean = False,
filter: expression = None,
default: any = None
) - > null

Parameters

NameTypeDescription
yexpressionThe dependent variable expression used as the first argument in the covariance calculation
xexpressionThe independent variable expression used as the second argument in the covariance calculation
sampleboolean = FalseDetermines whether to calculate sample covariance (COVAR_SAMP) instead of the default population covariance (COVAR_POP)
filterexpression = NoneAn optional boolean condition used to filter the rows included in the aggregate calculation
defaultany = NoneThe value to return if the calculation result is null or if no rows match the filter criteria