---
title: "mapGroups(_:)"
framework: tabulardata
role: symbol
role_heading: Instance Method
path: "tabulardata/rowgrouping/mapgroups(_:)"
---

# mapGroups(_:)

Generates a row grouping that applies a transformation closure to each group in the original.

## Declaration

```swift
func mapGroups(_ transform: (DataFrame.Slice) throws -> DataFrame) rethrows -> RowGrouping<GroupingKey>
```

## Parameters

- `transform`: A closure that generates a data frame from a data frame slice that represents a group.
