Skip to content

Commit 61cdd98

Browse files
committed
added missing notNull() case to update kdocs and fixed docs for notNull()
1 parent aa2b554 commit 61cdd98

File tree

1 file changed

+20
-1
lines changed
  • core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api

1 file changed

+20
-1
lines changed

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

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package org.jetbrains.kotlinx.dataframe.api
33
import org.jetbrains.kotlinx.dataframe.AnyRow
44
import org.jetbrains.kotlinx.dataframe.ColumnExpression
55
import org.jetbrains.kotlinx.dataframe.ColumnsSelector
6+
import org.jetbrains.kotlinx.dataframe.DataColumn
67
import org.jetbrains.kotlinx.dataframe.DataFrame
78
import org.jetbrains.kotlinx.dataframe.DataFrameExpression
89
import org.jetbrains.kotlinx.dataframe.DataRow
@@ -11,6 +12,7 @@ import org.jetbrains.kotlinx.dataframe.RowValueFilter
1112
import org.jetbrains.kotlinx.dataframe.annotations.AccessApiOverload
1213
import org.jetbrains.kotlinx.dataframe.annotations.Interpretable
1314
import org.jetbrains.kotlinx.dataframe.annotations.Refine
15+
import org.jetbrains.kotlinx.dataframe.api.mean
1416
import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup
1517
import org.jetbrains.kotlinx.dataframe.columns.ColumnReference
1618
import org.jetbrains.kotlinx.dataframe.columns.toColumnSet
@@ -78,6 +80,9 @@ public class Update<T, C>(
7880
* `\[ `__`.`__[**`at`**][Update.at]**`(`**[`rowIndices`][CommonUpdateAtFunctionDoc.RowIndicesParam]**`)`**` ]`
7981
*
8082
* {@include [Indent]}
83+
* `\[ `__`.`__[**`notNull`**][Update.notNull]**`()`**` ]`
84+
*
85+
* {@include [Indent]}
8186
* __`.`__[**`with`**][Update.with]**` { `**[`rowExpression`][ExpressionsGivenRow.RowValueExpression.WithExample]**` }`**
8287
*
8388
* {@include [Indent]}
@@ -403,7 +408,21 @@ internal infix fun <T, C> RowValueFilter<T, C>?.and(other: RowValueFilter<T, C>)
403408
return { thisExp(this, it) && other(this, it) }
404409
}
405410

406-
/** @include [Update.notNull] */
411+
/**
412+
* ## Not Null
413+
* Filters the update-selection to only include cells where the value is not null.
414+
*
415+
* This is shorthand for `.`[where][Update.where]` { it != null }`.
416+
*
417+
* For example:
418+
*
419+
* `df.`[update][update]` { `[colsOf][colsOf]`<`[Int][Int]`?>() }.`[notNull][notNull]`().`[perRowCol][Update.perRowCol]` { row, col ->`
420+
*
421+
* {@include [Indent]}`row\[col\] / col.`[mean][DataColumn.mean]`(skipNA = true)`
422+
*
423+
* `}`
424+
*/
425+
@Suppress("UNCHECKED_CAST")
407426
@Interpretable("UpdateNotNullDefault")
408427
public fun <T, C> Update<T, C?>.notNull(): Update<T, C> = where { it != null } as Update<T, C>
409428

0 commit comments

Comments
 (0)