# group

> For the complete documentation index, see [llms.txt](https://kotlin.github.io/dataframe/llms.txt).

Group columns into [ColumnGroups](datacolumn.html#columngroup).

API reference: [group](https://kotlin.github.io/dataframe/api-docs/core/org.jetbrains.kotlinx.dataframe.api/group.html)

```TEXT
group { columns }
    .into(groupName) | .into { groupNameExpression }

groupNameExpression = DataColumn.(DataColumn) -> String
```

Reverse operation: [ungroup](ungroup.html), [flatten](flatten.html)

It is a special case of [move](move.html) operation.

See [column selectors](columnselectors.html) for how to select the columns for this operation.

```KOTLIN
df.group { age and city }.into("info")

df.group { all() }.into { it.type().toString() }.print()
```

[Embedded content](resources/org.jetbrains.kotlinx.dataframe.samples.api.Modify.group.html)

