From 8d4474c0a3c219949b47947fed7711966487db72 Mon Sep 17 00:00:00 2001 From: Red Date: Sat, 29 Feb 2020 12:07:35 +0700 Subject: [PATCH 1/3] fix errors docstrings pandas.to_numeric --- pandas/core/tools/numeric.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pandas/core/tools/numeric.py b/pandas/core/tools/numeric.py index 4939cbfc9cc96..7c2ed542ae914 100644 --- a/pandas/core/tools/numeric.py +++ b/pandas/core/tools/numeric.py @@ -35,17 +35,23 @@ def to_numeric(arg, errors="raise", downcast=None): Parameters ---------- arg : scalar, list, tuple, 1-d array, or Series + Arg is consists of any kinds of type : + - scalar is any kind of numeric type data. + - list is any kind of '[]' dtypes. + - tuple is any kind of '()' dtypes. + - 1-d array is list dtypes that only have 1 list. + - Series is kind of pandas 1-d ndarray with axis labels. errors : {'ignore', 'raise', 'coerce'}, default 'raise' - If 'raise', then invalid parsing will raise an exception. - If 'coerce', then invalid parsing will be set as NaN. - If 'ignore', then invalid parsing will return the input. - downcast : {'integer', 'signed', 'unsigned', 'float'}, default None + downcast : {'int', 'signed', 'unsigned', 'float'}, default None If not None, and if the data has been successfully cast to a numerical dtype (or if the data was numeric to begin with), downcast that resulting data to the smallest numerical dtype possible according to the following rules: - - 'integer' or 'signed': smallest signed int dtype (min.: np.int8) + - 'int' or 'signed': smallest signed int dtype (min.: np.int8) - 'unsigned': smallest unsigned int dtype (min.: np.uint8) - 'float': smallest float dtype (min.: np.float32) @@ -61,7 +67,8 @@ def to_numeric(arg, errors="raise", downcast=None): Returns ------- - ret : numeric if parsing succeeded. + ret + Numeric if parsing succeeded. Return type depends on input. Series if Series, otherwise ndarray. See Also From 6536d6283c964c409575de1a23b62bd530610646 Mon Sep 17 00:00:00 2001 From: Red Date: Tue, 3 Mar 2020 10:03:45 +0700 Subject: [PATCH 2/3] revert back int to integer --- pandas/core/tools/numeric.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/core/tools/numeric.py b/pandas/core/tools/numeric.py index 7c2ed542ae914..e69a56f90c03d 100644 --- a/pandas/core/tools/numeric.py +++ b/pandas/core/tools/numeric.py @@ -45,13 +45,13 @@ def to_numeric(arg, errors="raise", downcast=None): - If 'raise', then invalid parsing will raise an exception. - If 'coerce', then invalid parsing will be set as NaN. - If 'ignore', then invalid parsing will return the input. - downcast : {'int', 'signed', 'unsigned', 'float'}, default None + downcast : {'integer', 'signed', 'unsigned', 'float'}, default None If not None, and if the data has been successfully cast to a numerical dtype (or if the data was numeric to begin with), downcast that resulting data to the smallest numerical dtype possible according to the following rules: - - 'int' or 'signed': smallest signed int dtype (min.: np.int8) + - 'integer' or 'signed': smallest signed int dtype (min.: np.int8) - 'unsigned': smallest unsigned int dtype (min.: np.uint8) - 'float': smallest float dtype (min.: np.float32) From d8494f2ba7e257845fa75b3adfb67e6b77e659be Mon Sep 17 00:00:00 2001 From: William Ayd Date: Tue, 3 Mar 2020 17:00:44 -0800 Subject: [PATCH 3/3] Update numeric.py --- pandas/core/tools/numeric.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/pandas/core/tools/numeric.py b/pandas/core/tools/numeric.py index e69a56f90c03d..8075c69a614d5 100644 --- a/pandas/core/tools/numeric.py +++ b/pandas/core/tools/numeric.py @@ -35,12 +35,7 @@ def to_numeric(arg, errors="raise", downcast=None): Parameters ---------- arg : scalar, list, tuple, 1-d array, or Series - Arg is consists of any kinds of type : - - scalar is any kind of numeric type data. - - list is any kind of '[]' dtypes. - - tuple is any kind of '()' dtypes. - - 1-d array is list dtypes that only have 1 list. - - Series is kind of pandas 1-d ndarray with axis labels. + Argument to be converted. errors : {'ignore', 'raise', 'coerce'}, default 'raise' - If 'raise', then invalid parsing will raise an exception. - If 'coerce', then invalid parsing will be set as NaN.