count
Counts the number of rows.
df
df.count() // the result is 10
Pass a row condition to count only the number of rows that satisfy that condition:
df.count { age > 15 } // the result is 8
df.count { "age"<Int>() > 15 } // the result is 8
On a GroupBy, Pivot, PivotGroupBy
When count is used in groupBy, pivot, or pivotGroupBy aggregations, it counts rows for every data group:
df.groupBy { city }.count()
df.groupBy("city").count()
df.pivot { city }.count { age > 18 }
df.pivot("city").count { "age"<Int>() > 18 }
df.pivot { name.firstName }.groupBy { name.lastName }.count()
df.pivot { "name"["firstName"] }
.groupBy { "name"["lastName"] }
.count()
On a DataRow
When called on a DataRow, returns the number of columns in this DataRow.
df[0].count() // the result is 5
If a predicate is used, it counts the number of elements in the row that satisfy the given predicate.
df[2].count { it == null } // the result is 1
On a DataColumn
When called on a DataColumn, returns the count of elements in the column that either match the predicate or the total count of elements if no predicate is provided.
df.age.count() // the result is 10
df.age.count { it > 17 } // the result is 8
09 September 2026