Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small implode fix #801

Merged
merged 3 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,14 @@ internal fun <T, C> DataFrame<T>.implodeImpl(dropNA: Boolean = false, columns: C
first = false
value
} else {
null
// these rows will not be taken into account,
// but we cannot leave them empty, as `map` creates a full column
when (column.kind()) {
ColumnKind.Value -> emptyList<Any?>()
ColumnKind.Group -> DataFrame.empty()
ColumnKind.Frame -> emptyList<AnyFrame>()
}
}
}
}[0..0]
}[0..0] // takes only the first row
}.concat()
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import org.jetbrains.kotlinx.dataframe.DataColumn
import org.jetbrains.kotlinx.dataframe.api.dataFrameOf
import org.jetbrains.kotlinx.dataframe.impl.isArray
import org.jetbrains.kotlinx.dataframe.impl.isPrimitiveArray
import org.jetbrains.kotlinx.dataframe.kind
import kotlin.reflect.KClass
import kotlin.reflect.KType
import kotlin.reflect.full.isSubclassOf
Expand Down Expand Up @@ -37,7 +38,7 @@ internal abstract class DataColumnImpl<T>(
if (BuildConfig.DEBUG) {
require(values.all { it matches type }) {
val types = values.map { if (it == null) "Nothing?" else it!!::class.simpleName }.distinct()
"Values of column '$name' have types '$types' which are not compatible given with column type '$type'"
"Values of $kind '$name' have types '$types' which are not compatible given with column type '$type'"
}
}
}
Expand Down
Loading