bottom
relationalai.semantics.std.aggregates
bottom(limit: int, *args: AggValue) -> AggregateGet the bottom N results in ascending order.
Parameters
Section titled “Parameters”
(limitint) - Number of bottom results to return.
(*argsAggValue, default:()) - Values to order by (ascending).
Returns
Section titled “Returns”Aggregate- AnAggregaterepresenting the computation of the bottom N results.
Examples
Section titled “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
Section titled “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