Skip to content

Commit

Permalink
DOC: use intersphinx mapping in pandas-compat ext (#15846)
Browse files Browse the repository at this point in the history
~~If #15704 is merged~~

This PR changes the header in the admonition (pandas compat box) to be hyperlinked to the pandas docs instead of just text. See https://raybellwaves.github.io/compatsphinxext/compat.html which is the docs of a minimal repo where I have been testing

Authors:
  - Ray Bell (https://github.com/raybellwaves)
  - Bradley Dice (https://github.com/bdice)
  - Vyas Ramasubramani (https://github.com/vyasr)

Approvers:
  - Vyas Ramasubramani (https://github.com/vyasr)

URL: #15846
  • Loading branch information
raybellwaves authored Jul 19, 2024
1 parent 461ed33 commit 2bbeee9
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 60 deletions.
2 changes: 1 addition & 1 deletion docs/cudf/source/developer_guide/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ The directive should be used inside docstrings like so:
Docstring body
.. pandas-compat::
**$API_NAME**
:meth:`pandas.DataFrame.METHOD`
Explanation of differences
```
Expand Down
12 changes: 10 additions & 2 deletions python/cudf/cudf/core/column/lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,9 +646,17 @@ def sort_values(
dtype: list
.. pandas-compat::
**ListMethods.sort_values**
`pandas.Series.list.sort_values`
The ``inplace`` and ``kind`` arguments are currently not supported.
This method does not exist in pandas but it can be run
as:
>>> import pandas as pd
>>> s = pd.Series([[3, 2, 1], [2, 4, 3]])
>>> print(s.apply(sorted))
0 [1, 2, 3]
1 [2, 3, 4]
dtype: object
"""
if inplace:
raise NotImplementedError("`inplace` not currently implemented.")
Expand Down
16 changes: 8 additions & 8 deletions python/cudf/cudf/core/column/string.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ def extract(
dtype: object
.. pandas-compat::
**StringMethods.extract**
:meth:`pandas.Series.str.extract`
The `flags` parameter currently only supports re.DOTALL and
re.MULTILINE.
Expand Down Expand Up @@ -738,7 +738,7 @@ def contains(
dtype: bool
.. pandas-compat::
**StringMethods.contains**
:meth:`pandas.Series.str.contains`
The parameters `case` and `na` are not yet supported and will
raise a NotImplementedError if anything other than the default
Expand Down Expand Up @@ -974,7 +974,7 @@ def replace(
dtype: object
.. pandas-compat::
**StringMethods.replace**
:meth:`pandas.Series.str.replace`
The parameters `case` and `flags` are not yet supported and will
raise a `NotImplementedError` if anything other than the default
Expand Down Expand Up @@ -2803,7 +2803,7 @@ def partition(self, sep: str = " ", expand: bool = True) -> SeriesOrIndex:
)
.. pandas-compat::
**StringMethods.partition**
:meth:`pandas.Series.str.partition`
The parameter `expand` is not yet supported and will raise a
`NotImplementedError` if anything other than the default
Expand Down Expand Up @@ -3527,7 +3527,7 @@ def count(self, pat: str, flags: int = 0) -> SeriesOrIndex:
Index([0, 0, 2, 1], dtype='int64')
.. pandas-compat::
**StringMethods.count**
:meth:`pandas.Series.str.count`
- `flags` parameter currently only supports re.DOTALL
and re.MULTILINE.
Expand Down Expand Up @@ -3607,7 +3607,7 @@ def findall(self, pat: str, flags: int = 0) -> SeriesOrIndex:
dtype: list
.. pandas-compat::
**StringMethods.findall**
:meth:`pandas.Series.str.findall`
The `flags` parameter currently only supports re.DOTALL and
re.MULTILINE.
Expand Down Expand Up @@ -3811,7 +3811,7 @@ def endswith(self, pat: str) -> SeriesOrIndex:
dtype: bool
.. pandas-compat::
**StringMethods.endswith**
:meth:`pandas.Series.str.endswith`
`na` parameter is not yet supported, as cudf uses
native strings instead of Python objects.
Expand Down Expand Up @@ -4264,7 +4264,7 @@ def match(
dtype: bool
.. pandas-compat::
**StringMethods.match**
:meth:`pandas.Series.str.match`
Parameters `case` and `na` are currently not supported.
The `flags` parameter currently only supports re.DOTALL and
Expand Down
37 changes: 19 additions & 18 deletions python/cudf/cudf/core/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -2750,7 +2750,7 @@ def reindex(
Chrome 200 0.02
.. pandas-compat::
**DataFrame.reindex**
:meth:`pandas.DataFrame.reindex`
Note: One difference from Pandas is that ``NA`` is used for rows
that do not match, rather than ``NaN``. One side effect of this is
Expand Down Expand Up @@ -3350,7 +3350,7 @@ def diff(self, periods=1, axis=0):
5 2 5 20
.. pandas-compat::
**DataFrame.diff**
:meth:`pandas.DataFrame.diff`
Diff currently only supports numeric dtype columns.
"""
Expand Down Expand Up @@ -3555,7 +3555,7 @@ def rename(
30 3 6
.. pandas-compat::
**DataFrame.rename**
:meth:`pandas.DataFrame.rename`
* Not Supporting: level
Expand Down Expand Up @@ -3670,7 +3670,7 @@ def agg(self, aggs, axis=None):
``DataFrame`` is returned.
.. pandas-compat::
**DataFrame.agg**
:meth:`pandas.DataFrame.agg`
* Not supporting: ``axis``, ``*args``, ``**kwargs``
Expand Down Expand Up @@ -3843,7 +3843,7 @@ def nlargest(self, n, columns, keep="first"):
Brunei 434000 12128 BN
.. pandas-compat::
**DataFrame.nlargest**
:meth:`pandas.DataFrame.nlargest`
- Only a single column is supported in *columns*
"""
Expand Down Expand Up @@ -3915,7 +3915,7 @@ def nsmallest(self, n, columns, keep="first"):
Nauru 337000 182 NR
.. pandas-compat::
**DataFrame.nsmallest**
:meth:`pandas.DataFrame.nsmallest`
- Only a single column is supported in *columns*
"""
Expand Down Expand Up @@ -3997,7 +3997,7 @@ def transpose(self):
a new (ncol x nrow) dataframe. self is (nrow x ncol)
.. pandas-compat::
**DataFrame.transpose, DataFrame.T**
:meth:`pandas.DataFrame.transpose`, :attr:`pandas.DataFrame.T`
Not supporting *copy* because default and only behavior is
copy=True
Expand Down Expand Up @@ -4188,7 +4188,7 @@ def merge(
from both sides.
.. pandas-compat::
**DataFrame.merge**
:meth:`pandas.DataFrame.merge`
DataFrames merges in cuDF result in non-deterministic row
ordering.
Expand Down Expand Up @@ -4263,7 +4263,7 @@ def join(
joined : DataFrame
.. pandas-compat::
**DataFrame.join**
:meth:`pandas.DataFrame.join`
- *other* must be a single DataFrame for now.
- *on* is not supported yet due to lack of multi-index support.
Expand Down Expand Up @@ -4385,7 +4385,7 @@ def query(self, expr, local_dict=None):
1 2018-10-08
.. pandas-compat::
**DataFrame.query**
:meth:`pandas.DataFrame.query`
One difference from pandas is that ``query`` currently only
supports numeric, datetime, timedelta, or bool dtypes.
Expand Down Expand Up @@ -5447,10 +5447,11 @@ def from_arrow(cls, table):
2 3 6
.. pandas-compat::
**DataFrame.from_arrow**
`pandas.DataFrame.from_arrow`
- Does not support automatically setting index column(s) similar
to how ``to_pandas`` works for PyArrow Tables.
This method does not exist in pandas but it is similar to
how :meth:`pyarrow.Table.to_pandas` works for PyArrow Tables i.e.
it does not support automatically setting index column(s).
"""
index_col = None
col_index_names = None
Expand Down Expand Up @@ -5884,7 +5885,7 @@ def quantile(
0.5 2.5 55.0
.. pandas-compat::
**DataFrame.quantile**
:meth:`pandas.DataFrame.quantile`
One notable difference from Pandas is when DataFrame is of
non-numeric types and result is expected to be a Series in case of
Expand Down Expand Up @@ -6174,7 +6175,7 @@ def count(self, axis=0, numeric_only=False):
dtype: int64
.. pandas-compat::
**DataFrame.count**
:meth:`pandas.DataFrame.count`
Parameters currently not supported are `axis` and `numeric_only`.
"""
Expand Down Expand Up @@ -6412,7 +6413,7 @@ def mode(self, axis=0, numeric_only=False, dropna=True):
1 <NA> 2.0
.. pandas-compat::
**DataFrame.mode**
:meth:`pandas.DataFrame.transpose`
``axis`` parameter is currently not supported.
"""
Expand Down Expand Up @@ -7594,7 +7595,7 @@ def interleave_columns(self):
The interleaved columns as a single column
.. pandas-compat::
**DataFrame.interleave_columns**
`pandas.DataFrame.interleave_columns`
This method does not exist in pandas but it can be run
as ``pd.Series(np.vstack(df.to_numpy()).reshape((-1,)))``.
Expand Down Expand Up @@ -7696,7 +7697,7 @@ def eval(self, expr: str, inplace: bool = False, **kwargs):
4 5 2 7 3
.. pandas-compat::
**DataFrame.eval**
:meth:`pandas.DataFrame.eval`
* Additional kwargs are not supported.
* Bitwise and logical operators are not dtype-dependent.
Expand Down
10 changes: 5 additions & 5 deletions python/cudf/cudf/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ def where(self, cond, other=None, inplace: bool = False) -> Self | None:
dtype: int64
.. pandas-compat::
**DataFrame.where, Series.where**
:meth:`pandas.DataFrame.where`, :meth:`pandas.Series.where`
Note that ``where`` treats missing values as falsy,
in parallel with pandas treatment of nullable data:
Expand Down Expand Up @@ -1641,7 +1641,7 @@ def min(
1
.. pandas-compat::
**DataFrame.min, Series.min**
:meth:`pandas.DataFrame.min`, :meth:`pandas.Series.min`
Parameters currently not supported are `level`, `numeric_only`.
"""
Expand Down Expand Up @@ -1689,7 +1689,7 @@ def max(
dtype: int64
.. pandas-compat::
**DataFrame.max, Series.max**
:meth:`pandas.DataFrame.max`, :meth:`pandas.Series.max`
Parameters currently not supported are `level`, `numeric_only`.
"""
Expand Down Expand Up @@ -1742,7 +1742,7 @@ def all(self, axis=0, skipna=True, **kwargs):
dtype: bool
.. pandas-compat::
**DataFrame.all, Series.all**
:meth:`pandas.DataFrame.all`, :meth:`pandas.Series.all`
Parameters currently not supported are `axis`, `bool_only`,
`level`.
Expand Down Expand Up @@ -1795,7 +1795,7 @@ def any(self, axis=0, skipna=True, **kwargs):
dtype: bool
.. pandas-compat::
**DataFrame.any, Series.any**
:meth:`pandas.DataFrame.any`, :meth:`pandas.Series.any`
Parameters currently not supported are `axis`, `bool_only`,
`level`.
Expand Down
9 changes: 6 additions & 3 deletions python/cudf/cudf/core/groupby/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,8 @@ def _reduce(
Computed {op} of values within each group.
.. pandas-compat::
**{cls}.{op}**
:meth:`pandas.core.groupby.DataFrameGroupBy.{op}`,
:meth:`pandas.core.groupby.SeriesGroupBy.{op}`
The numeric_only, min_count
"""
Expand Down Expand Up @@ -1482,7 +1483,8 @@ def mult(df):
6 2 6 12
.. pandas-compat::
**GroupBy.apply**
:meth:`pandas.core.groupby.DataFrameGroupBy.apply`,
:meth:`pandas.core.groupby.SeriesGroupBy.apply`
cuDF's ``groupby.apply`` is limited compared to pandas.
In some situations, Pandas returns the grouped keys as part of
Expand Down Expand Up @@ -2358,7 +2360,8 @@ def shift(self, periods=1, freq=None, axis=0, fill_value=None):
Object shifted within each group.
.. pandas-compat::
**GroupBy.shift**
:meth:`pandas.core.groupby.DataFrameGroupBy.shift`,
:meth:`pandas.core.groupby.SeriesGroupBy.shift`
Parameter ``freq`` is unsupported.
"""
Expand Down
Loading

0 comments on commit 2bbeee9

Please sign in to comment.