diff --git a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/flatten.kt b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/flatten.kt index 07102bac1..7a9ede21d 100644 --- a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/flatten.kt +++ b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/flatten.kt @@ -13,33 +13,33 @@ import kotlin.reflect.KProperty @Refine @Interpretable("FlattenDefault") -public fun DataFrame.flatten(keepParentNameForColumns: Boolean = false, separator: String = "."): DataFrame = +public fun DataFrame.flatten(keepParentNameForColumns: Boolean = false, separator: String = "_"): DataFrame = flatten(keepParentNameForColumns, separator) { all() } @Refine @Interpretable("Flatten0") public fun DataFrame.flatten( keepParentNameForColumns: Boolean = false, - separator: String = ".", + separator: String = "_", columns: ColumnsSelector, ): DataFrame = flattenImpl(columns, keepParentNameForColumns, separator) public fun DataFrame.flatten( vararg columns: String, keepParentNameForColumns: Boolean = false, - separator: String = ".", + separator: String = "_", ): DataFrame = flatten(keepParentNameForColumns, separator) { columns.toColumnSet() } public fun DataFrame.flatten( vararg columns: ColumnReference, keepParentNameForColumns: Boolean = false, - separator: String = ".", + separator: String = "_", ): DataFrame = flatten(keepParentNameForColumns, separator) { columns.toColumnSet() } public fun DataFrame.flatten( vararg columns: KProperty, keepParentNameForColumns: Boolean = false, - separator: String = ".", + separator: String = "_", ): DataFrame = flatten(keepParentNameForColumns, separator) { columns.toColumnSet() } // endregion diff --git a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/api/flatten.kt b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/api/flatten.kt index 25f8f4c41..bd692ef2f 100644 --- a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/api/flatten.kt +++ b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/api/flatten.kt @@ -15,7 +15,7 @@ import org.jetbrains.kotlinx.dataframe.impl.columns.toColumnSet internal fun DataFrame.flattenImpl( columns: ColumnsSelector, keepParentNameForColumns: Boolean = false, - separator: String = ".", + separator: String = "_", ): DataFrame { val rootColumns = getColumnsWithPaths { columns.toColumnSet().filter { it.isColumnGroup() }.simplify() diff --git a/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/flatten.kt b/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/flatten.kt index 6dcd4a93d..aa457c95b 100644 --- a/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/flatten.kt +++ b/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/flatten.kt @@ -98,7 +98,7 @@ class FlattenTests { aggregate .flatten(keepParentNameForColumns = true) - .columnNames() shouldBe listOf("city", "mean.age", "mean.weight", "std.age", "std.weight") + .columnNames() shouldBe listOf("city", "mean_age", "mean_weight", "std_age", "std_weight") aggregate .flatten(keepParentNameForColumns = true, separator = "_happy_separator_")