Skip to content

Commit

Permalink
Notes convert to Pandas-compat (#12641)
Browse files Browse the repository at this point in the history
  • Loading branch information
Touutae-lab authored Jan 24, 2024
1 parent 0a4ce51 commit 60f04ce
Show file tree
Hide file tree
Showing 9 changed files with 343 additions and 274 deletions.
10 changes: 5 additions & 5 deletions python/cudf/cudf/core/column/lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,11 +620,6 @@ def sort_values(
-------
Series or Index with each list sorted
Notes
-----
Difference from pandas:
* Not supporting: `inplace`, `kind`
Examples
--------
>>> s = cudf.Series([[4, 2, None, 9], [8, 8, 2], [2, 1]])
Expand All @@ -633,6 +628,11 @@ def sort_values(
1 [2.0, 8.0, 8.0]
2 [1.0, 2.0]
dtype: list
.. pandas-compat::
**ListMethods.sort_values**
The ``inplace`` and ``kind`` arguments are currently not supported.
"""
if inplace:
raise NotImplementedError("`inplace` not currently implemented.")
Expand Down
107 changes: 58 additions & 49 deletions python/cudf/cudf/core/column/string.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,11 +594,6 @@ def extract(
for each group. If `expand=False` and `pat` has only one capture
group, then return a Series/Index.
Notes
-----
The `flags` parameter currently only supports re.DOTALL and
re.MULTILINE.
Examples
--------
>>> import cudf
Expand All @@ -625,6 +620,12 @@ def extract(
1 2
2 <NA>
dtype: object
.. pandas-compat::
**StringMethods.extract**
The `flags` parameter currently only supports re.DOTALL and
re.MULTILINE.
""" # noqa W605
if not _is_supported_regex_flags(flags):
raise NotImplementedError(
Expand Down Expand Up @@ -672,14 +673,6 @@ def contains(
pattern is contained within the string of each element of the
Series/Index.
Notes
-----
The parameters `case` and `na` are not yet supported and will
raise a NotImplementedError if anything other than the default
value is set.
The `flags` parameter currently only supports re.DOTALL and
re.MULTILINE.
Examples
--------
>>> import cudf
Expand Down Expand Up @@ -753,6 +746,15 @@ def contains(
3 True
4 <NA>
dtype: bool
.. pandas-compat::
**StringMethods.contains**
The parameters `case` and `na` are not yet supported and will
raise a NotImplementedError if anything other than the default
value is set.
The `flags` parameter currently only supports re.DOTALL and
re.MULTILINE.
""" # noqa W605
if na is not np.nan:
raise NotImplementedError("`na` parameter is not yet supported")
Expand Down Expand Up @@ -951,12 +953,6 @@ def replace(
A copy of the object with all matching occurrences of pat replaced
by repl.
Notes
-----
The parameters `case` and `flags` are not yet supported and will raise
a `NotImplementedError` if anything other than the default value
is set.
Examples
--------
>>> import cudf
Expand Down Expand Up @@ -986,6 +982,13 @@ def replace(
1 fuz
2 <NA>
dtype: object
.. pandas-compat::
**StringMethods.replace**
The parameters `case` and `flags` are not yet supported and will
raise a `NotImplementedError` if anything other than the default
value is set.
"""
if case is not None:
raise NotImplementedError("`case` parameter is not yet supported")
Expand Down Expand Up @@ -2769,11 +2772,6 @@ def partition(self, sep: str = " ", expand: bool = True) -> SeriesOrIndex:
DataFrame or MultiIndex
Returns a DataFrame / MultiIndex
Notes
-----
The parameter `expand` is not yet supported and will raise a
`NotImplementedError` if anything other than the default value is set.
See Also
--------
rpartition
Expand Down Expand Up @@ -2815,6 +2813,14 @@ def partition(self, sep: str = " ", expand: bool = True) -> SeriesOrIndex:
MultiIndex([('X', ' ', '123'),
('Y', ' ', '999')],
)
.. pandas-compat::
**StringMethods.partition**
The parameter `expand` is not yet supported and will raise a
`NotImplementedError` if anything other than the default
value is set.
"""
if expand is not True:
raise NotImplementedError(
Expand Down Expand Up @@ -3500,14 +3506,6 @@ def count(self, pat: str, flags: int = 0) -> SeriesOrIndex:
-------
Series or Index
Notes
-----
- `flags` parameter currently only supports re.DOTALL
and re.MULTILINE.
- Some characters need to be escaped when passing
in pat. e.g. ``'$'`` has a special meaning in regex
and must be escaped when finding this literal character.
Examples
--------
>>> import cudf
Expand Down Expand Up @@ -3539,6 +3537,15 @@ def count(self, pat: str, flags: int = 0) -> SeriesOrIndex:
>>> index = cudf.Index(['A', 'A', 'Aaba', 'cat'])
>>> index.str.count('a')
Int64Index([0, 0, 2, 1], dtype='int64')
.. pandas-compat::
**StringMethods.count**
- `flags` parameter currently only supports re.DOTALL
and re.MULTILINE.
- Some characters need to be escaped when passing
in pat. e.g. ``'$'`` has a special meaning in regex
and must be escaped when finding this literal character.
""" # noqa W605
if isinstance(pat, re.Pattern):
flags = pat.flags & ~re.U
Expand Down Expand Up @@ -3570,11 +3577,6 @@ def findall(self, pat: str, flags: int = 0) -> SeriesOrIndex:
All non-overlapping matches of pattern or
regular expression in each string of this Series/Index.
Notes
-----
The `flags` parameter currently only supports re.DOTALL and
re.MULTILINE.
Examples
--------
>>> import cudf
Expand Down Expand Up @@ -3615,6 +3617,12 @@ def findall(self, pat: str, flags: int = 0) -> SeriesOrIndex:
1 []
2 [b, b]
dtype: list
.. pandas-compat::
**StringMethods.findall**
The `flags` parameter currently only supports re.DOTALL and
re.MULTILINE.
"""
if isinstance(pat, re.Pattern):
flags = pat.flags & ~re.U
Expand Down Expand Up @@ -3797,11 +3805,6 @@ def endswith(self, pat: str) -> SeriesOrIndex:
A Series of booleans indicating whether the given
pattern matches the end of each string element.
Notes
-----
`na` parameter is not yet supported, as cudf uses
native strings instead of Python objects.
Examples
--------
>>> import cudf
Expand All @@ -3818,6 +3821,12 @@ def endswith(self, pat: str) -> SeriesOrIndex:
2 False
3 <NA>
dtype: bool
.. pandas-compat::
**StringMethods.endswith**
`na` parameter is not yet supported, as cudf uses
native strings instead of Python objects.
"""
if pat is None:
raise TypeError(
Expand Down Expand Up @@ -4245,13 +4254,6 @@ def match(
-------
Series or Index of boolean values.
Notes
-----
Parameters `case` and `na` are currently not supported.
The `flags` parameter currently only supports re.DOTALL and
re.MULTILINE.
Examples
--------
>>> import cudf
Expand All @@ -4272,6 +4274,13 @@ def match(
1 True
2 True
dtype: bool
.. pandas-compat::
**StringMethods.match**
Parameters `case` and `na` are currently not supported.
The `flags` parameter currently only supports re.DOTALL and
re.MULTILINE.
"""
if case is not True:
raise NotImplementedError("`case` parameter is not yet supported")
Expand Down
Loading

0 comments on commit 60f04ce

Please sign in to comment.