From 6e8b3d1939b33c8274f8fa2fecf4df0f624409df Mon Sep 17 00:00:00 2001 From: Xinrong Meng Date: Thu, 17 Oct 2024 14:06:37 +0800 Subject: [PATCH 1/5] adjust --- python/pyspark/pandas/plot/core.py | 9 ++++----- python/pyspark/sql/plot/core.py | 10 ++++------ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/python/pyspark/pandas/plot/core.py b/python/pyspark/pandas/plot/core.py index 12c17a06f153b..3e70c6e5bf445 100644 --- a/python/pyspark/pandas/plot/core.py +++ b/python/pyspark/pandas/plot/core.py @@ -841,7 +841,7 @@ def barh(self, x=None, y=None, **kwargs): elif isinstance(self.data, DataFrame): return self(kind="barh", x=x, y=y, **kwargs) - def box(self, precision=0.01, **kwds): + def box(self, **kwds): """ Make a box plot of the DataFrame columns. @@ -857,13 +857,12 @@ def box(self, precision=0.01, **kwds): Parameters ---------- - precision: scalar, default = 0.01 - This argument is used by pandas-on-Spark to compute approximate statistics - for building a boxplot. Use *smaller* values to get more precise - statistics. **kwds : optional Additional keyword arguments are documented in :meth:`pyspark.pandas.Series.plot`. + One of the optional keyword arguments is `precision`, a float that is used by + pandas-on-Spark to compute approximate statistics for building a boxplot. + The default value is 0.01. Use smaller values to get more precise statistics. Returns ------- diff --git a/python/pyspark/sql/plot/core.py b/python/pyspark/sql/plot/core.py index f44c0768d4337..aad4bcbcb62f8 100644 --- a/python/pyspark/sql/plot/core.py +++ b/python/pyspark/sql/plot/core.py @@ -359,9 +359,7 @@ def pie(self, x: str, y: str, **kwargs: Any) -> "Figure": ) return self(kind="pie", x=x, y=y, **kwargs) - def box( - self, column: Union[str, List[str]], precision: float = 0.01, **kwargs: Any - ) -> "Figure": + def box(self, column: Union[str, List[str]], **kwargs: Any) -> "Figure": """ Make a box plot of the DataFrame columns. @@ -377,11 +375,11 @@ def box( ---------- column: str or list of str Column name or list of names to be used for creating the boxplot. - precision: float, default = 0.01 - This argument is used by pyspark to compute approximate statistics - for building a boxplot. **kwargs Additional keyword arguments. + One of the optional keyword arguments is `precision`, a float that is used by + pyspark to compute approximate statistics for building a boxplot. The default + value is 0.01. Use smaller values to get more precise statistics. Returns ------- From 36c7091cd5ac6f1dace64aab888315adeecf6907 Mon Sep 17 00:00:00 2001 From: Xinrong Meng Date: Thu, 17 Oct 2024 17:43:26 +0800 Subject: [PATCH 2/5] adjust --- python/pyspark/pandas/plot/core.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/python/pyspark/pandas/plot/core.py b/python/pyspark/pandas/plot/core.py index 3e70c6e5bf445..9412414d840e9 100644 --- a/python/pyspark/pandas/plot/core.py +++ b/python/pyspark/pandas/plot/core.py @@ -857,12 +857,13 @@ def box(self, **kwds): Parameters ---------- - **kwds : optional + **kwds : dict, optional Additional keyword arguments are documented in :meth:`pyspark.pandas.Series.plot`. - One of the optional keyword arguments is `precision`, a float that is used by - pandas-on-Spark to compute approximate statistics for building a boxplot. - The default value is 0.01. Use smaller values to get more precise statistics. + precision: scalar, default = 0.01 + This argument is used by pandas-on-Spark to compute approximate statistics + for building a boxplot. Use smaller values to get more precise + statistics. Returns ------- From 072466587b9d9cfa36f4c5b5f6ab9409bd29b8a8 Mon Sep 17 00:00:00 2001 From: Xinrong Meng Date: Thu, 17 Oct 2024 17:46:13 +0800 Subject: [PATCH 3/5] fix --- python/pyspark/pandas/plot/core.py | 2 +- python/pyspark/sql/plot/core.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/python/pyspark/pandas/plot/core.py b/python/pyspark/pandas/plot/core.py index 9412414d840e9..80e3ab787083f 100644 --- a/python/pyspark/pandas/plot/core.py +++ b/python/pyspark/pandas/plot/core.py @@ -901,7 +901,7 @@ def box(self, **kwds): from pyspark.pandas import DataFrame, Series if isinstance(self.data, (Series, DataFrame)): - return self(kind="box", precision=precision, **kwds) + return self(kind="box", **kwds) def hist(self, bins=10, **kwds): """ diff --git a/python/pyspark/sql/plot/core.py b/python/pyspark/sql/plot/core.py index aad4bcbcb62f8..b14f480f9091a 100644 --- a/python/pyspark/sql/plot/core.py +++ b/python/pyspark/sql/plot/core.py @@ -402,7 +402,7 @@ def box(self, column: Union[str, List[str]], **kwargs: Any) -> "Figure": >>> df.plot.box(column="math_score") # doctest: +SKIP >>> df.plot.box(column=["math_score", "english_score"]) # doctest: +SKIP """ - return self(kind="box", column=column, precision=precision, **kwargs) + return self(kind="box", column=column, **kwargs) def kde( self, From 1686518d00b5fe7ef7f3369e6ff841c84439ce87 Mon Sep 17 00:00:00 2001 From: Xinrong Meng Date: Fri, 18 Oct 2024 10:03:33 +0800 Subject: [PATCH 4/5] numpydoc fmt --- python/pyspark/pandas/plot/core.py | 9 ++++----- python/pyspark/sql/plot/core.py | 7 +++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/python/pyspark/pandas/plot/core.py b/python/pyspark/pandas/plot/core.py index 80e3ab787083f..5a6722a9c5ad9 100644 --- a/python/pyspark/pandas/plot/core.py +++ b/python/pyspark/pandas/plot/core.py @@ -858,12 +858,11 @@ def box(self, **kwds): Parameters ---------- **kwds : dict, optional - Additional keyword arguments are documented in + Extra arguments to `precision `: refer to a float that is used by + pandas-on-Spark to compute approximate statistics for building a + boxplot. The default value is 0.01. Use smaller values to get more + precise statistics. Additional keyword arguments are documented in :meth:`pyspark.pandas.Series.plot`. - precision: scalar, default = 0.01 - This argument is used by pandas-on-Spark to compute approximate statistics - for building a boxplot. Use smaller values to get more precise - statistics. Returns ------- diff --git a/python/pyspark/sql/plot/core.py b/python/pyspark/sql/plot/core.py index b14f480f9091a..1dccc450c8a72 100644 --- a/python/pyspark/sql/plot/core.py +++ b/python/pyspark/sql/plot/core.py @@ -376,10 +376,9 @@ def box(self, column: Union[str, List[str]], **kwargs: Any) -> "Figure": column: str or list of str Column name or list of names to be used for creating the boxplot. **kwargs - Additional keyword arguments. - One of the optional keyword arguments is `precision`, a float that is used by - pyspark to compute approximate statistics for building a boxplot. The default - value is 0.01. Use smaller values to get more precise statistics. + Extra arguments to `precision `: refer to a float that is used by + pyspark to compute approximate statistics for building a boxplot. + The default value is 0.01. Use smaller values to get more precise statistics. Returns ------- From 49fa0bce84dfcc1a0c0a35bb739cc09cf9af9f1c Mon Sep 17 00:00:00 2001 From: Xinrong Meng Date: Fri, 18 Oct 2024 10:05:10 +0800 Subject: [PATCH 5/5] - space --- python/pyspark/pandas/plot/core.py | 2 +- python/pyspark/sql/plot/core.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/python/pyspark/pandas/plot/core.py b/python/pyspark/pandas/plot/core.py index 5a6722a9c5ad9..f5652177fe4a5 100644 --- a/python/pyspark/pandas/plot/core.py +++ b/python/pyspark/pandas/plot/core.py @@ -858,7 +858,7 @@ def box(self, **kwds): Parameters ---------- **kwds : dict, optional - Extra arguments to `precision `: refer to a float that is used by + Extra arguments to `precision`: refer to a float that is used by pandas-on-Spark to compute approximate statistics for building a boxplot. The default value is 0.01. Use smaller values to get more precise statistics. Additional keyword arguments are documented in diff --git a/python/pyspark/sql/plot/core.py b/python/pyspark/sql/plot/core.py index 1dccc450c8a72..178411e5c5ef8 100644 --- a/python/pyspark/sql/plot/core.py +++ b/python/pyspark/sql/plot/core.py @@ -376,7 +376,7 @@ def box(self, column: Union[str, List[str]], **kwargs: Any) -> "Figure": column: str or list of str Column name or list of names to be used for creating the boxplot. **kwargs - Extra arguments to `precision `: refer to a float that is used by + Extra arguments to `precision`: refer to a float that is used by pyspark to compute approximate statistics for building a boxplot. The default value is 0.01. Use smaller values to get more precise statistics.