flatten

fun <T> DataFrame<T>.flatten(keepParentNameForColumns: Boolean = false, separator: String = "_"): DataFrame<T>

The Flatten Operation

Removes all column groups in the DataFrame, replacing them with their leaf columns.

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

The columns to flatten need to be selected. See org.jetbrains.kotlinx.dataframe.api.FlattenDocs.FlattenSelectingOptions for all the selecting options

Return

A new DataFrame with the all column groups flattened.

Parameters

keepParentNameForColumns

If true, retains the parent column name as a prefix for the flattened columns. The prefix is separated from the original column names using the provided separator. Defaults to false.

separator

The string used to separate parent column names and the original column names when keepParentNameForColumns is true. Defaults to "_".

See also


fun <T, C> DataFrame<T>.flatten(keepParentNameForColumns: Boolean = false, separator: String = "_", columns: ColumnsSelector<T, C>): DataFrame<T>

The Flatten Operation

Removes specified column groups in the DataFrame, replacing them with their leaf columns.

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

The columns to flatten need to be selected. See org.jetbrains.kotlinx.dataframe.api.FlattenDocs.FlattenSelectingOptions for all the selecting options

Return

A new DataFrame with the specified column groups flattened.

Parameters

keepParentNameForColumns

If true, retains the parent column name as a prefix for the flattened columns. The prefix is separated from the original column names using the provided separator. Defaults to false.

separator

The string used to separate parent column names and the original column names when keepParentNameForColumns is true. Defaults to "_".

columns

The names of the columns or selector determining which column groups should be flattened.

See also


fun <T> DataFrame<T>.flatten(vararg columns: String, keepParentNameForColumns: Boolean = false, separator: String = "_"): DataFrame<T>

The Flatten Operation

Removes selected column groups in the DataFrame, replacing them with their leaf columns.

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

The columns to flatten need to be selected. See org.jetbrains.kotlinx.dataframe.api.FlattenDocs.FlattenSelectingOptions for all the selecting options

Return

A new DataFrame with the selected column groups flattened.

Parameters

keepParentNameForColumns

If true, retains the parent column name as a prefix for the flattened columns. The prefix is separated from the original column names using the provided separator. Defaults to false.

separator

The string used to separate parent column names and the original column names when keepParentNameForColumns is true. Defaults to "_".

columns

The names of the columns or selector determining which column groups should be flattened.

See also


fun <T, C> DataFrame<T>.flatten(vararg columns: ColumnReference<C>, keepParentNameForColumns: Boolean = false, separator: String = "_"): DataFrame<T>
fun <T, C> DataFrame<T>.flatten(vararg columns: KProperty<C>, keepParentNameForColumns: Boolean = false, separator: String = "_"): DataFrame<T>

Deprecated

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

The Flatten Operation

Removes selected column groups in the DataFrame, replacing them with their leaf columns.

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

The columns to flatten need to be selected. See org.jetbrains.kotlinx.dataframe.api.FlattenDocs.FlattenSelectingOptions for all the selecting options

Return

A new DataFrame with the selected column groups flattened.

Parameters

keepParentNameForColumns

If true, retains the parent column name as a prefix for the flattened columns. The prefix is separated from the original column names using the provided separator. Defaults to false.

separator

The string used to separate parent column names and the original column names when keepParentNameForColumns is true. Defaults to "_".

columns

The names of the columns or selector determining which column groups should be flattened.

See also