# single

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

Returns the single value in this [DataColumn](datacolumn.html). Throws [NoSuchElementException](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-no-such-element-exception/) if the [DataColumn](datacolumn.html) is empty, and [IllegalArgumentException](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/) if it contains more than one value.

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

```KOTLIN
df
```

[Embedded content](./resources/singleOnColumnDf.html)

Properties:

```KOTLIN
df
    .filter { name == "Bob" } // one row is left after filtering
    .age
    .single() // returns 20
```

Strings:

```KOTLIN
df
    .filter { "name"<String>() == "Bob" } // one row is left after filtering
    .age
    .single() // returns 20
```

Use [first](firstoncolumn.html) or [last](lastoncolumn.html) when the [DataColumn](datacolumn.html) may contain more than one value, and [firstOrNull](firstoncolumn.html#firstornull) when it may be empty — there is no `singleOrNull` for a [DataColumn](datacolumn.html).

