# distinct

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

Removes duplicate rows. The rows in the resulting [DataFrame](dataframe.html) are in the same order as they were in the original [DataFrame](dataframe.html).

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

Related operations: [Filter rows](filterrows.html)

```KOTLIN
df.distinct()
```

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

If columns are specified, resulting [DataFrame](dataframe.html) will have only given columns with distinct values.

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

Properties:

```KOTLIN
df.distinct { age and name }
// same as
df.select { age and name }.distinct()
```

Strings:

```KOTLIN
df.distinct("age", "name")
// same as
df.select("age", "name").distinct()
```

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

## distinctBy

Keep only the first row for every group of rows grouped by some condition.

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

Properties:

```KOTLIN
df.distinctBy { age and name }
// same as
df.groupBy { age and name }.mapToRows { group.first() }
```

Strings:

```KOTLIN
df.distinctBy("age", "name")
// same as
df.groupBy("age", "name").mapToRows { group.first() }
```

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

