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

docs: Improve docs about NaN #20310

Merged
merged 1 commit into from
Dec 16, 2024
Merged
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
13 changes: 9 additions & 4 deletions docs/source/user-guide/expressions/missing-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,19 @@ instead of the function `fill_null`:

## Not a Number, or `NaN` values

Missing data in a series is represented by the value `null`, regardless of the data type of the
series. However, in columns that have a floating point data type, the value `NaN` can be used. These
values can be created directly:
Missing data in a series is only ever represented by the value `null`, regardless of the data type
of the series. Columns with a floating point data type can sometimes have the value `NaN`, which
might be confused with `null`.

The special value `NaN` can be created directly:

{{code_block('user-guide/expressions/missing-data','nan',['DataFrame'])}}

```python exec="on" result="text" session="user-guide/missing-data"
--8<-- "python/user-guide/expressions/missing-data.py:nan"
```

The special value `NaN` might also arise as the result of a computation:
And it might also arise as the result of a computation:

{{code_block('user-guide/expressions/missing-data','nan-computed',[])}}

Expand Down Expand Up @@ -180,3 +182,6 @@ can be avoided by replacing the occurrences of the value `NaN` with the value `n
```python exec="on" result="text" session="user-guide/missing-data"
--8<-- "python/user-guide/expressions/missing-data.py:nanfill"
```

You can learn more about the value `NaN` in
[the section about floating point number data types](../concepts/data-types-and-structures.md#floating-point-numbers).
Loading