Skip to main content
Skip to main content

argMaxIf

Description

The If combinator can be applied to the argMax function to find the value of arg that corresponds to the maximum value of val for rows where the condition is true, using the argMaxIf aggregate combinator function.

The argMaxIf function is useful when you need to find the value associated with the maximum value in a dataset, but only for rows that satisfy a specific condition.

Example Usage

In this example, we'll use a sample dataset of product sales to demonstrate how argMaxIf works. We'll find the product name that has the highest price, but only for products that have been sold at least 10 times.

The argMaxIf function will return the product name that has the highest price among all products that have been sold at least 10 times (sales_count >= 10). In this case, it will return 'Laptop' since it has the highest price (999.99) among the popular products.

See also