From 2839b7c71b41ac3f7ed3d7197c08644b6ad4daaf Mon Sep 17 00:00:00 2001 From: galipremsagar Date: Tue, 9 Mar 2021 19:49:01 -0800 Subject: [PATCH] minor alignment fixes --- python/cudf/cudf/core/dataframe.py | 2 ++ python/cudf/cudf/core/series.py | 25 +++++++++++++++---------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/python/cudf/cudf/core/dataframe.py b/python/cudf/cudf/core/dataframe.py index 02cb061f4ed..5ab058ff495 100644 --- a/python/cudf/cudf/core/dataframe.py +++ b/python/cudf/cudf/core/dataframe.py @@ -4163,6 +4163,7 @@ def nlargest(self, n, columns, keep="first"): Column label(s) to order by. keep : {'first', 'last'}, default 'first' Where there are duplicate values: + - `first` : prioritize the first occurrence(s) - `last` : prioritize the last occurrence(s) @@ -4225,6 +4226,7 @@ def nsmallest(self, n, columns, keep="first"): Column name or names to order by. keep : {'first', 'last'}, default 'first' Where there are duplicate values: + - ``first`` : take the first occurrence. - ``last`` : take the last occurrence. diff --git a/python/cudf/cudf/core/series.py b/python/cudf/cudf/core/series.py index 019553ffc13..2a990eef32e 100644 --- a/python/cudf/cudf/core/series.py +++ b/python/cudf/cudf/core/series.py @@ -1256,8 +1256,8 @@ def to_string(self): 4 dtype: object >>> series.to_string() - '0 a\n1 \n2 b\n3 c\n4 \ndtype: object' - """ + '0 a\\n1 \\n2 b\\n3 c\\n4 \\ndtype: object' + """ # noqa : E501 return self.__repr__() def __str__(self): @@ -2523,6 +2523,7 @@ def drop_duplicates(self, keep="first", inplace=False, ignore_index=False): ---------- keep : {'first', 'last', ``False``}, default 'first' Method to handle dropping duplicates: + - 'first' : Drop duplicates except for the first occurrence. - 'last' : Drop duplicates except for the last occurrence. - ``False`` : Drop all duplicates. @@ -3017,11 +3018,12 @@ def astype(self, dtype, copy=False, errors="raise"): values then may propagate to other cudf objects. errors : {'raise', 'ignore', 'warn'}, default 'raise' Control raising of exceptions on invalid data for provided dtype. + - ``raise`` : allow exceptions to be raised - ``ignore`` : suppress exceptions. On error return original - object. + object. - ``warn`` : prints last exceptions as warnings and - return original object. + return original object. Returns ------- @@ -3059,7 +3061,7 @@ def astype(self, dtype, copy=False, errors="raise"): dtype: category Categories (2, int64): [2 < 1] - Note that using `copy=False`(enabled by default) + Note that using ``copy=False`` (enabled by default) and changing data on a new Series will propagate changes: @@ -3267,10 +3269,11 @@ def nlargest(self, n=5, keep="first"): keep : {'first', 'last'}, default 'first' When there are duplicate values that cannot all fit in a Series of `n` elements: + - ``first`` : return the first `n` occurrences in order - of appearance. + of appearance. - ``last`` : return the last `n` occurrences in reverse - order of appearance. + order of appearance. Returns ------- @@ -3319,7 +3322,8 @@ def nlargest(self, n=5, keep="first"): return self._n_largest_or_smallest(n=n, keep=keep, largest=True) def nsmallest(self, n=5, keep="first"): - """Returns a new Series of the *n* smallest element. + """ + Returns a new Series of the *n* smallest element. Parameters ---------- @@ -3328,10 +3332,11 @@ def nsmallest(self, n=5, keep="first"): keep : {'first', 'last'}, default 'first' When there are duplicate values that cannot all fit in a Series of `n` elements: + - ``first`` : return the first `n` occurrences in order - of appearance. + of appearance. - ``last`` : return the last `n` occurrences in reverse - order of appearance. + order of appearance. Returns -------