Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-49948][PS][CONNECT] Add parameter "precision" to pandas on Spark box plot #48445

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions python/pyspark/pandas/plot/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, **kwds):
def box(self, precision=0.01, **kwds):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on second thought, I think we'd better still hide precision in **kwds, because it is a spark-sepcific implementation details.

we can document it in under the **kwds docstring.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense! Created https://issues.apache.org/jira/browse/SPARK-50001 for that.

"""
Make a box plot of the DataFrame columns.

Expand All @@ -857,14 +857,13 @@ def box(self, **kwds):

Parameters
----------
**kwds : optional
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 (matplotlib-only).
statistics.
**kwds : optional
Additional keyword arguments are documented in
:meth:`pyspark.pandas.Series.plot`.

Returns
-------
Expand Down Expand Up @@ -902,7 +901,7 @@ def box(self, **kwds):
from pyspark.pandas import DataFrame, Series

if isinstance(self.data, (Series, DataFrame)):
return self(kind="box", **kwds)
return self(kind="box", precision=precision, **kwds)

def hist(self, bins=10, **kwds):
"""
Expand Down