# flatten

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

Returns [DataFrame](dataframe.html) without column groupings under selected columns.

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

```TEXT
flatten  [ { columns } ]
```

Columns will keep their original names after flattening. Potential column name clashes are resolved by adding the minimal possible name prefix from ancestor columns.

Related operations: [Group / ungroup / flatten columns](groupungroupflatten.html)

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

Properties:

```KOTLIN
// name.firstName -> firstName
// name.lastName -> lastName
df.flatten { name }
```

Strings:

```KOTLIN
// name.firstName -> firstName
// name.lastName -> lastName
df.flatten("name")
```

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

To remove all column groupings in [DataFrame](dataframe.html), invoke `flatten` without parameters:

```KOTLIN
df.flatten()
```

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

