Skip to main content

module  pixeltable.functions

General Pixeltable UDFs. This parent module contains general-purpose UDFs that apply to multiple data types.

func  map()

Signature
Applies a mapping function to each element of a list. Parameters:
  • expr (pixeltable.exprs.expr.Expr): The list expression to map over; must be an expression of type pxt.Json.
  • fn (typing.Callable[[pixeltable.exprs.expr.Expr], typing.Any]): An operation on Pixeltable expressions that will be applied to each element of the JSON array.
Examples: Given a table tbl with a column data of type pxt.Json containing lists of integers, add a computed column that produces new lists with each integer doubled:

uda  count()

Signatures
Aggregate function that counts the number of non-null values in a column or grouping. Parameters:
  • val (String | None): The value to count.
Returns:
  • pxt.Int: The count of non-null values.
Examples: Count the number of non-null values in the value column of the table tbl:
Group by the category column and compute the count of non-null values in the value column for each category, assigning the name 'category_count' to the new column:

uda  max()

Signatures
Aggregate function that computes the maximum value in a column or grouping. Parameters:
  • val (String | None): The value to compare.
Returns:
  • pxt.String | None: The maximum value, or None if there are no non-null values.
Examples: Compute the maximum value in the value column of the table tbl:
Group by the category column and compute the maximum value in the value column for each category, assigning the name 'category_max' to the new column:

uda  mean()

Signatures
Aggregate function that computes the mean (average) of non-null values of a numeric column or grouping. Parameters:
  • val (Int | None): The numeric value to include in the mean.
Returns:
  • pxt.Float | None: The mean of the non-null values, or None if there are no non-null values.
Examples: Compute the mean of the values in the value column of the table tbl:
Group by the category column and compute the mean of the value column for each category, assigning the name 'category_mean' to the new column:

uda  min()

Signatures
Aggregate function that computes the minimum value in a column or grouping. Parameters:
  • val (String | None): The value to compare.
Returns:
  • pxt.String | None: The minimum value, or None if there are no non-null values.
Examples: Compute the minimum value in the value column of the table tbl:
Group by the category column and compute the minimum value in the value column for each category, assigning the name 'category_min' to the new column:

uda  sum()

Signatures
Aggregate function that computes the sum of non-null values of a numeric column or grouping. Parameters:
  • val (Int | None): The numeric value to add to the sum.
Returns:
  • pxt.Int | None: The sum of the non-null values, or None if there are no non-null values.
Examples: Sum the values in the value column of the table tbl:
Group by the category column and compute the sum of the value column for each category, assigning the name 'category_total' to the new column:
Last modified on January 15, 2026