NVIDIA / NVIDIA/cudf

[FEA] Allow mode.pandas_compatible to make nunique treat nan as NA

Open
#13,988 2 comments 0 reactions 0 assignees View on GitHub
feature request Python
Dominant language
C++
Stars
9.8k
Forks
1.1k
Avg merge
3d 6m
Merged PRs (30d)
278

Description

**Is your feature request related to a problem? Please describe.**
In pandas, `nunique` ignores NA including nan. There is no way to currently mimic this behavior in cudf

```
In [58]: import pandas

In [59]: import cudf

In [60]: import numpy as np

In [61]: cudf.Series([0.1, np.nan], nan_as_null=False).nunique()
Out[61]: 2

In [62]: pandas.Series([0.1, np.nan]).nunique()
Out[62]: 1
```

**Describe the solution you'd like**
It might be nice if `mode.pandas_compatible` would treat nan as NA and exclude `np.nan` from the `nunique`

**Describe alternatives you've considered**
Adding a `nan_as_null`, but I am not sure about thoughts of expanding the API

**Additional context**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.