Compute count aggregation. Examples: >>> import ray >>> ray.data.from_items([ # doctest: +SKIP ... {"A": x % 3, "B": x} for x in range(100)]).groupby( # doctest: +SKIP ... "A").count() # doctest: +SKIP Returns: A d
(self)
| 375 | |
| 376 | @PublicAPI(api_group=CDS_API_GROUP) |
| 377 | def count(self) -> Dataset: |
| 378 | """Compute count aggregation. |
| 379 | |
| 380 | Examples: |
| 381 | >>> import ray |
| 382 | >>> ray.data.from_items([ # doctest: +SKIP |
| 383 | ... {"A": x % 3, "B": x} for x in range(100)]).groupby( # doctest: +SKIP |
| 384 | ... "A").count() # doctest: +SKIP |
| 385 | |
| 386 | Returns: |
| 387 | A dataset of ``[k, v]`` columns where ``k`` is the groupby key and |
| 388 | ``v`` is the number of rows with that key. |
| 389 | If groupby key is ``None`` then the key part of return is omitted. |
| 390 | """ |
| 391 | return self.aggregate(Count()) |
| 392 | |
| 393 | @PublicAPI(api_group=CDS_API_GROUP) |
| 394 | def sum( |