diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/DocumentationUrls.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/DocumentationUrls.kt index dca4463c9e..2227500253 100644 --- a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/DocumentationUrls.kt +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/DocumentationUrls.kt @@ -19,6 +19,16 @@ internal interface DocumentationUrls { interface RowConditions } + /** [See `NaN` and `NA` on the documentation website.](https://kotlin.github.io/dataframe/nanAndNa.html) */ + interface NanAndNa { + + /** [See `NaN` on the documentation website.](https://kotlin.github.io/dataframe/nanAndNa.html#nan) */ + interface NaN + + /** [See `NA` on the documentation website.](https://kotlin.github.io/dataframe/nanAndNa.html#na) */ + interface NA + } + /** [See `update` on the documentation website.](https://kotlin.github.io/dataframe/update.html) */ interface Update diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/NA.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/NA.kt index 35251f23fd..d8f9d513ad 100644 --- a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/NA.kt +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/NA.kt @@ -13,6 +13,8 @@ import org.jetbrains.kotlinx.dataframe.api.fillNA * You can also use [fillNA][fillNA] to replace `NAs` in certain columns with a given value or expression * or [dropNA][dropNA] to drop rows with `NAs` in them. * + * For more information: [See `NA` on the documentation website.](https://kotlin.github.io/dataframe/nanAndNa.html#na) + * * @see NaN */ internal interface NA diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/NaN.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/NaN.kt index 18b9792947..bcb89b72cf 100644 --- a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/NaN.kt +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/NaN.kt @@ -11,6 +11,8 @@ import org.jetbrains.kotlinx.dataframe.api.fillNaNs * You can also use [fillNaNs][fillNaNs] to replace `NaNs` in certain columns with a given value or expression * or [dropNaNs][dropNaNs] to drop rows with `NaNs` in them. * + * For more information: [See `NaN` on the documentation website.](https://kotlin.github.io/dataframe/nanAndNa.html#nan) + * * @see NA */ internal interface NaN diff --git a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/DocumentationUrls.kt b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/DocumentationUrls.kt index 0c6f6f992e..edca077c6b 100644 --- a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/DocumentationUrls.kt +++ b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/DocumentationUrls.kt @@ -19,6 +19,16 @@ internal interface DocumentationUrls { interface RowConditions } + /** [{@include [Text]}{@arg [NameArg] `NaN` and `NA`}]({@include [Url]}/nanAndNa.html) */ + interface NanAndNa { + + /** [{@include [Text]}{@arg [NameArg] `NaN`}]({@include [Url]}/nanAndNa.html#nan) */ + interface NaN + + /** [{@include [Text]}{@arg [NameArg] `NA`}]({@include [Url]}/nanAndNa.html#na) */ + interface NA + } + /** [{@include [Text]}{@arg [NameArg] `update`}]({@include [Url]}/update.html) */ interface Update diff --git a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/NA.kt b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/NA.kt index 35251f23fd..e5433a1316 100644 --- a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/NA.kt +++ b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/NA.kt @@ -13,6 +13,8 @@ import org.jetbrains.kotlinx.dataframe.api.fillNA * You can also use [fillNA][fillNA] to replace `NAs` in certain columns with a given value or expression * or [dropNA][dropNA] to drop rows with `NAs` in them. * + * For more information: {@include [DocumentationUrls.NanAndNa.NA]} + * * @see NaN */ internal interface NA diff --git a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/NaN.kt b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/NaN.kt index 18b9792947..11e2ef0ea9 100644 --- a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/NaN.kt +++ b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/NaN.kt @@ -11,6 +11,8 @@ import org.jetbrains.kotlinx.dataframe.api.fillNaNs * You can also use [fillNaNs][fillNaNs] to replace `NaNs` in certain columns with a given value or expression * or [dropNaNs][dropNaNs] to drop rows with `NaNs` in them. * + * For more information: {@include [DocumentationUrls.NanAndNa.NaN]} + * * @see NA */ internal interface NaN diff --git a/docs/StardustDocs/d.tree b/docs/StardustDocs/d.tree index 0c530e382a..6b3798872a 100644 --- a/docs/StardustDocs/d.tree +++ b/docs/StardustDocs/d.tree @@ -35,6 +35,7 @@ + diff --git a/docs/StardustDocs/topics/cumSum.md b/docs/StardustDocs/topics/cumSum.md index 00fa12cd54..0dcd052334 100644 --- a/docs/StardustDocs/topics/cumSum.md +++ b/docs/StardustDocs/topics/cumSum.md @@ -11,7 +11,7 @@ cumSum(skipNA = true) [ { columns } ] Returns a [`DataFrame`](DataFrame.md) or [`DataColumn`](DataColumn.md) containing the cumulative sum. **Parameters:** -* `skipNA` — when `true`, ignores `NA` (`null` or `NaN`) values. +* `skipNA` — when `true`, ignores [`NA` values](nanAndNa.md#na) (`null` or `NaN`). When `false`, all values after first `NA` will be `NaN` (for `Double` and `Float` columns) or `null` (for integer columns). **Available for:** diff --git a/docs/StardustDocs/topics/drop.md b/docs/StardustDocs/topics/drop.md index 4152f6c08e..166ec23b54 100644 --- a/docs/StardustDocs/topics/drop.md +++ b/docs/StardustDocs/topics/drop.md @@ -55,7 +55,7 @@ df.dropNulls(whereAllNull = true) { city and weight } // remove rows with null v ## dropNaNs -Remove rows with `Double.NaN` or `Float.NaN` values +Remove rows with [`NaN` values](nanAndNa.md#nan) (`Double.NaN` or `Float.NaN`). @@ -72,7 +72,7 @@ df.dropNaNs(whereAllNaN = true) { age and weight } // remove rows where both 'ag ## dropNA -Remove rows with `null`, `Double.NaN` or `Float.NaN` values +Remove rows with [`NA` values](nanAndNa.md#na) (`null`, `Double.NaN`, or `Float.NaN`). diff --git a/docs/StardustDocs/topics/fill.md b/docs/StardustDocs/topics/fill.md index 33e1624b39..ddf8f8c06f 100644 --- a/docs/StardustDocs/topics/fill.md +++ b/docs/StardustDocs/topics/fill.md @@ -21,7 +21,7 @@ df.update { colsOf() }.where { it == null }.with { -1 } ## fillNaNs -Replaces `Double.NaN` and `Float.NaN` values with given value or expression. +Replaces [`NaN` values](nanAndNa.md#nan) (`Double.NaN` and `Float.NaN`) with given value or expression. @@ -34,7 +34,7 @@ df.fillNaNs { colsOf() }.withZero() ## fillNA -Replaces `null`, `Double.NaN` and `Float.NaN` values with given value or expression. +Replaces [`NA` values](nanAndNa.md#na) (`null`, `Double.NaN`, and `Float.NaN`) with given value or expression. diff --git a/docs/StardustDocs/topics/mean.md b/docs/StardustDocs/topics/mean.md index 2144d31e9f..44156d4d50 100644 --- a/docs/StardustDocs/topics/mean.md +++ b/docs/StardustDocs/topics/mean.md @@ -4,7 +4,8 @@ Computes the mean of values. -Is available for numeric columns. Computed value has type `Double`. Use `skipNA` flag to skip `null` and `NaN` values. +Is available for numeric columns. Computed value has type `Double`. +Use `skipNA` flag to skip [`NA` values](nanAndNa.md#na) (`null` and `NaN`). diff --git a/docs/StardustDocs/topics/median.md b/docs/StardustDocs/topics/median.md index e9faad1e3e..4bd4c93520 100644 --- a/docs/StardustDocs/topics/median.md +++ b/docs/StardustDocs/topics/median.md @@ -4,7 +4,7 @@ Computes the median of values. -Is available for `Comparable` columns. `null` and `NaN` values are ignored. +Is available for `Comparable` columns. [`NA` values](nanAndNa.md#na) (`null` and `NaN`) are ignored. diff --git a/docs/StardustDocs/topics/minmax.md b/docs/StardustDocs/topics/minmax.md index fda5ecd948..f264a16d6b 100644 --- a/docs/StardustDocs/topics/minmax.md +++ b/docs/StardustDocs/topics/minmax.md @@ -4,8 +4,8 @@ Computes the minimum / maximum of values. -Is available for [`Comparable`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-comparable/) columns. -`null` and `NaN` values are ignored. +Is available for [`Comparable`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-comparable/) columns. +[`NA` values](nanAndNa.md#na) (`null` and `NaN`) are ignored. diff --git a/docs/StardustDocs/topics/nanAndNa.md b/docs/StardustDocs/topics/nanAndNa.md new file mode 100644 index 0000000000..77fb92b43b --- /dev/null +++ b/docs/StardustDocs/topics/nanAndNa.md @@ -0,0 +1,24 @@ +[//]: # (title: NaN and NA) + +Using the Kotlin DataFrame library, you might come across the terms `NaN` and `NA`. +This page explains what they mean and how to work with them. + +## NaN + +`Float` or `Double` values can be represented as `NaN`, +in cases where a mathematical operation is undefined, such as for dividing by zero. The +result of such an operation can only be described as "**N**ot **a** **N**umber". + +This is different from `null`, which means that a value is missing and, in Kotlin, can only occur +for `Float?` and `Double?` types. + +You can use [fillNaNs](fill.md#fillnans) to replace `NaNs` in certain columns with a given value or expression +or [dropNaNs](drop.md#dropnans) to drop rows with `NaNs` in them. + +## NA + +`NA` in Dataframe can be seen as: [`NaN`](#nan) or `null`. Which is another way to say that the value +is "**N**ot **A**vailable". + +You can use [fillNA](fill.md#fillna) to replace `NAs` in certain columns with a given value or expression +or [dropNA](drop.md#dropna) to drop rows with `NAs` in them. diff --git a/docs/StardustDocs/topics/sum.md b/docs/StardustDocs/topics/sum.md index ae50adac8b..c4f7ef1fc1 100644 --- a/docs/StardustDocs/topics/sum.md +++ b/docs/StardustDocs/topics/sum.md @@ -4,7 +4,7 @@ Computes the sum of values. -`null` and `NaN` values are ignored. +[`NA` values](nanAndNa.md#na) (`null` and `NaN`) are ignored.