bottom
relationalai.semantics.std.aggregates
bottom(limit: int, *args: AggValue) -> AggregateGet the bottom N results in ascending order.
Parameters
(limitint) - Number of bottom results to return.
(*argsAggValue, default:()) - Values to order by (ascending).
Returns
Aggregate- AnAggregaterepresenting the computation of the bottom N results.
Examples
Get 10 lowest-priced products:
select(Product).where(aggregates.bottom(10, Product.price))Get 5 least selling products per category:
select(Product).where( aggregates.bottom(5, Product.units_sold) .per(Category) .where(Product.category == Category))Referenced By
RelationalAI Documentation ├── Build With RelationalAI │ └── Understand how PyRel works │ ├── Build a semantic model │ │ └── Query a model │ │ └── Rank and select top results withrank,asc,desc, andtop│ └── Use advanced reasoning > Rules-based reasoning │ └── Aggregate and group data │ └── Pick top and bottom results └── Release Notes └── Python API Release Notes └── What’s New in Version 1.17.0 └── Bug Fixes and Diagnostics