aggregates#

relationalai.std

The relationalai.std.aggregates namespace contains functions for performing aggregations, such as count() and sum(). Include the following import at the top of your Python file to use these functions:

#from relationalai.std import aggregates

# Or, if you prefer a shorter name:
from relationalai.std import aggregates as agg

Table of Contents#

Statistics#

FunctionDescriptionReturn Type
avg()Calculates the average of all distinct values produced by a Producer.Expression
count()Counts the number of distinct values produced by a Producer.Expression
max()Calculates the maximum value produced by a Producer.Expression
min()Calculates the minimum value produced by a Producer.Expression
sum()Calculates the sum of distinct values produced by a Producer.Expression

Strings#

FunctionDescriptionReturn Type
concat()Concatenates all distinct string values produced by a Producer.Expression

Sorting, Ordering, and Limiting#

FunctionDescriptionReturn Type
rank_asc()Sorts distinct values produced by a Producer in ascending order.Expression
rank_desc()Sorts distinct values produced by a Producer in descending order.Expression
bottom()Limits the values produced by a Producer to a specified number of smallest values.Expression
top()Limits the values produced by a Producer to a specified number of largest values.Expression