NVIDIA / NVIDIA/cudf

[DOC] `.mode()` incorrectly states that axis=1 is supported as it throws "NotImplementedError" when you try

Open
#11,570 2 comments 0 reactions 0 assignees View on GitHub
1 - On Deck doc Python
Dominant language
C++
Stars
9.8k
Forks
1.1k
Avg merge
3d 6m
Merged PRs (30d)
278

Description

## Report incorrect documentation

**Location of incorrect documentation**
https://docs.rapids.ai/api/cudf/stable/api_docs/api/cudf.DataFrame.mode.html?highlight=mode#cudf.DataFrame.mode

**Describe the problems or issues found in the documentation**
Documentation says that mode can be applied over columns (axis = 0) or rows (axis = 1), but when trying axis = 1, it says `Only axis=0 is currently supported`

**Steps taken to verify documentation is incorrect**

```
import cudf
df = cudf.DataFrame(np.random.randint(0,5,size=(15, 10)), columns=list('ABCDEFGHIJ'))
df.mode(axis=1)
```
Stack trace
```
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
/tmp/ipykernel_2243/3323872345.py in
----> 1 df.mode(axis=1)

/opt/conda/envs/rapids/lib/python3.8/contextlib.py in inner(*args, **kwds)
73 def inner(*args, **kwds):
74 with self._recreate_cm():
---> 75 return func(*args, **kwds)
76 return inner
77

/opt/conda/envs/rapids/lib/python3.8/site-packages/cudf/core/dataframe.py in mode(self, axis, numeric_only, dropna)
5678 """
5679 if axis not in (0, "index"):
-> 5680 raise NotImplementedError("Only axis=0 is currently supported")
5681
5682 if numeric_only:

NotImplementedError: Only axis=0 is currently supported
```
**Suggested fix for documentation**
Either
1. state that axis = 1 is not supported
2. remove references for axis = 1 in docs
3. add the functionality

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.