pyspark.pandas.DataFrame.plot.box#

plot.box(**kwds)#

Make a box plot of the DataFrame columns.

A box plot is a method for graphically depicting groups of numerical data through their quartiles. The box extends from the Q1 to Q3 quartile values of the data, with a line at the median (Q2). The whiskers extend from the edges of box to show the range of the data. The position of the whiskers is set by default to 1.5*IQR (IQR = Q3 - Q1) from the edges of the box. Outlier points are those past the end of the whiskers.

A consideration when using this chart is that the box and the whiskers can overlap, which is very common when plotting small sets of data.

Parameters
**kwdsoptional

Additional keyword arguments are documented in 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).

Returns
plotly.graph_objs.Figure

Return an custom object when backend!=plotly. Return an ndarray when subplots=True (matplotlib-only).

Notes

There are behavior differences between pandas-on-Spark and pandas.

  • pandas-on-Spark computes approximate statistics - expect differences between pandas and pandas-on-Spark boxplots, especially regarding 1st and 3rd quartiles.

  • The whis argument is only supported as a single number.

  • pandas-on-Spark doesn’t support the following argument(s) (matplotlib-only).

    • bootstrap argument is not supported

    • autorange argument is not supported

Examples

Draw a box plot from a DataFrame with four columns of randomly generated data.

For Series:

>>> data = np.random.randn(25, 4)
>>> df = ps.DataFrame(data, columns=list('ABCD'))
>>> df['A'].plot.box()  

This is an unsupported function for DataFrame type