Skip to content

count

relationalai.semantics.std.aggregates
count(*args: AggValue) -> Aggregate

Count the number of values.

Parameters

  • *args

    (AggValue, default: ()) - Values to count. Can include Distinct wrapper for distinct count.

Returns

  • Aggregate - An Aggregate representing the computation of the count. Returns Integer.

Examples

Count all employees:

select(aggregates.count(Employee))

Count employees per department:

select(Department, aggregates.count(Employee).per(Department))

Referenced By

RelationalAI Documentation
├──  Build With RelationalAI
│   └──  Understand how PyRel works
│       ├──  Build a semantic model
│       │   └──  Query a model
│       │       └──  Aggregate results with count and per
│       └──  Use advanced reasoning > Rules-based reasoning
│           └──  Aggregate and group data
│               └──  Count matches with .count()
└──  Release Notes
    └──  Python API Release Notes
        └──  What’s New in Version 1.17.0
            └──  Bug Fixes and Diagnostics