Skip to content

Commit 5bc9783

Browse files
group kdocs fix
1 parent 0b22f16 commit 5bc9783

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/group.kt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ internal interface GroupDocs {
6161
* {@include [DslGrammarLink]}
6262
* {@include [LineBreak]}
6363
*
64-
* [**`into`**][GroupClause.into]**`(`**`groupName: `[`String`][String]**`)`**
64+
* **[`group`][group]****` { `**`columnsSelector: `[`ColumnsSelector`][ColumnsSelector]**` }`**
65+
*
66+
* {@include [Indent]}
67+
* __`.`__[**`into`**][GroupClause.into]**`(`**`groupName: `[`String`][String]**`)`**
6568
*
6669
* {@include [Indent]}
6770
* __`.`__[**`into`**][GroupClause.into]**` { `**`groupNameExpression: `[`ColumnsSelector`][ColumnsSelector]**` } `**
@@ -181,12 +184,13 @@ public fun <T, C> GroupClause<T, C>.into(column: ColumnsSelectionDsl<T>.(ColumnW
181184
*
182185
* ### Examples:
183186
* ```kotlin
184-
* // Group selected columns into an existing column group:
187+
* // Group selected columns into an existing column group (common for all selected columns):
185188
* df.group("age", "weight").into { info }
186-
* // Group selected columns into a nested column group using a path that may
187-
* // contain both existing and new segments:
189+
*
190+
* // Group selected columns into a nested column group using a path (common for all selected columns) that may contain both existing and new segments:
188191
* df.group { employee.age and employee.weight }.into { pathOf("info", "personal") }
189-
* // Group selected columns under their ancestor group located two levels up in the path hierarchy
192+
*
193+
* // For each selected column, place it under its ancestor group from two levels up in the column path hierarchy (individual for each column):
190194
* df.group { colsAtAnyDepth().colsOf<String>() }.into { it.path.dropLast(2) }
191195
* ```
192196
*

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/ungroup.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import kotlin.reflect.KProperty
2424
* See [Selecting Columns][UngroupSelectingOptions].
2525
*
2626
* For more information: {@include [DocumentationUrls.Ungroup]}
27+
*
28+
* Reverse operation: [group].
2729
*/
2830
internal interface UngroupDocs {
2931
/**

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/api/describe.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,12 @@ private fun DataColumn<Any?>.convertToComparableOrNull(): DataColumn<Comparable<
117117
valuesAreComparable() -> asComparable()
118118

119119
// Found incomparable number types, convert all to Double first
120-
isNumber() -> with(cast<Number?>()) {
121-
map {
122-
if (it?.isPrimitiveNumber() == false) return@convertToComparableOrNull null
123-
it?.toDouble() as Comparable<Any>?
120+
isNumber() -> cast<Number?>().map {
121+
if (it?.isPrimitiveNumber() == false) {
122+
// Cannot calculate statistics of a non-primitive number type
123+
return@convertToComparableOrNull null
124124
}
125+
it?.toDouble() as Comparable<Any>?
125126
}
126127

127128
else -> null

0 commit comments

Comments
 (0)