Skip to content

NA and NaN docs #411

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

Merged
merged 3 commits into from
Jun 21, 2023
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 @@ -19,6 +19,16 @@ internal interface DocumentationUrls {
interface RowConditions
}

/** [See `NaN` and `NA` on the documentation website.](https://kotlin.github.io/dataframe/nanAndNa.html) */
Copy link
Collaborator

@zaleslaw zaleslaw Jun 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a new pattern to refer on the Documentation site. Is it correct that we did not do it earlier?
It seems good idea, but probably let's discuss it widely.

Because it looks like adding yet one detail to the hierarchy of documents produced by your plugin

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it was used before in Update.kt and Nulls.kt, you can see the other URLs in the file ;)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now I see, thanks

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions docs/StardustDocs/d.tree
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<toc-element topic="DataColumn.md"/>
<toc-element topic="DataRow.md"/>
</toc-element>
<toc-element topic="nanAndNa.md"/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably better to move under operations (for first time)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it's not an operation. I'm not comfortable having it there, seems weird. Probably we can find a better place after restructuring the docs/flattening them.

<toc-element topic="operations.md"/>
<toc-element toc-title="Operations">
<toc-element topic="create.md">
Expand Down
2 changes: 1 addition & 1 deletion docs/StardustDocs/topics/cumSum.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:**
Expand Down
4 changes: 2 additions & 2 deletions docs/StardustDocs/topics/drop.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`).

<!---FUN dropNaNs-->

Expand All @@ -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`).

<!---FUN dropNA-->

Expand Down
4 changes: 2 additions & 2 deletions docs/StardustDocs/topics/fill.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ df.update { colsOf<Int?>() }.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.

<!---FUN fillNaNs-->

Expand All @@ -34,7 +34,7 @@ df.fillNaNs { colsOf<Double>() }.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.

<!---FUN fillNA-->

Expand Down
3 changes: 2 additions & 1 deletion docs/StardustDocs/topics/mean.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`).

<!---FUN meanModes-->

Expand Down
2 changes: 1 addition & 1 deletion docs/StardustDocs/topics/median.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<!---FUN medianModes-->

Expand Down
4 changes: 2 additions & 2 deletions docs/StardustDocs/topics/minmax.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<!---FUN minmaxModes-->

Expand Down
24 changes: 24 additions & 0 deletions docs/StardustDocs/topics/nanAndNa.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion docs/StardustDocs/topics/sum.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<!---FUN statisticModes-->

Expand Down