cudf
cudf copied to clipboard
[DOC] `.mode()` incorrectly states that axis=1 is supported as it throws "NotImplementedError" when you try
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 <module>
----> 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
- state that axis = 1 is not supported
- remove references for axis = 1 in docs
- add the functionality
In this case, df.T.mode(axis=0).T
might solve the problem as expected. Generally, there are quite a few places where keyword arguments (especially axis
) are documented, but non-default values are not yet supported.
This issue has been labeled inactive-30d
due to no recent activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be labeled inactive-90d
if there is no activity in the next 60 days.