firstCol

open fun SingleColumn<DataRow<*>>.firstCol(condition: (ColumnWithPath<*>) -> Boolean = { true }): SingleColumn<*>

First (Col)

Returns the first column from this that adheres to the optional given condition. If no column adheres to the given condition, NoSuchElementException is thrown.

This function operates solely on columns at the top-level.

NOTE: For column groups, first is named firstCol instead to avoid confusion.

For more information: See First (Col), Last (Col), Single (Col) on the documentation website.

Check out: Grammar

Examples:

df.select{ first{ it.name().startsWith("order") } }

df.select{ "myColumnGroup".firstCol{ it.name().startsWith("year") } }

Examples for this overload:

df.select{ myColumnGroup.firstCol() }

Return

A SingleColumn containing the first column that adheres to the given condition.

Parameters

condition

The optional ColumnFilter condition that the column must adhere to.

See also

Throws

if no column adheres to the given condition.


open fun String.firstCol(condition: (ColumnWithPath<*>) -> Boolean = { true }): SingleColumn<*>

First (Col)

Returns the first column from this that adheres to the optional given condition. If no column adheres to the given condition, NoSuchElementException is thrown.

This function operates solely on columns at the top-level.

NOTE: For column groups, first is named firstCol instead to avoid confusion.

For more information: See First (Col), Last (Col), Single (Col) on the documentation website.

Check out: Grammar

Examples:

df.select{ first{ it.name().startsWith("order") } }

df.select{ "myColumnGroup".firstCol{ it.name().startsWith("year") } }

Examples for this overload:

df.select{ "myColumnGroup".firstCol{ it.name().startsWith("year") } }

Return

A SingleColumn containing the first column that adheres to the given condition.

Parameters

condition

The optional ColumnFilter condition that the column must adhere to.

See also

Throws

if no column adheres to the given condition.


open fun ColumnPath.firstCol(condition: (ColumnWithPath<*>) -> Boolean = { true }): SingleColumn<*>

First (Col)

Returns the first column from this that adheres to the optional given condition. If no column adheres to the given condition, NoSuchElementException is thrown.

This function operates solely on columns at the top-level.

NOTE: For column groups, first is named firstCol instead to avoid confusion.

For more information: See First (Col), Last (Col), Single (Col) on the documentation website.

Check out: Grammar

Examples:

df.select{ first{ it.name().startsWith("order") } }

df.select{ "myColumnGroup".firstCol{ it.name().startsWith("year") } }

Examples for this overload:

df.select{ "pathTo"["myColumnGroup"].firstCol{ it.name().startsWith("year") } }

Return

A SingleColumn containing the first column that adheres to the given condition.

Parameters

condition

The optional ColumnFilter condition that the column must adhere to.

See also

Throws

if no column adheres to the given condition.


open fun KProperty<*>.firstCol(condition: (ColumnWithPath<*>) -> Boolean = { true }): SingleColumn<*>

Deprecated

It's recommended to migrate to the String or Extension Properties Access API https://kotlin.github.io/dataframe/apilevels.html

First (Col)

Returns the first column from this that adheres to the optional given condition. If no column adheres to the given condition, NoSuchElementException is thrown.

This function operates solely on columns at the top-level.

NOTE: For column groups, first is named firstCol instead to avoid confusion.

For more information: See First (Col), Last (Col), Single (Col) on the documentation website.

Check out: Grammar

Examples:

df.select{ first{ it.name().startsWith("order") } }

df.select{ "myColumnGroup".firstCol{ it.name().startsWith("year") } }

Examples for this overload:

df.select{ Type::myColumnGroup.firstCol{ it.name().startsWith("year") } }

df.select{ DataSchemaType::myColumnGroup.firstCol() }

Return

A SingleColumn containing the first column that adheres to the given condition.

Parameters

condition

The optional ColumnFilter condition that the column must adhere to.

See also

Throws

if no column adheres to the given condition.