w3resource

Pandas DataFrame: - plot.box() function

DataFrame.plot.box() function

The plot.box() function is used to 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.

For further details see Wikipedia’s entry for boxplot.

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.

Syntax:

DataFrame.plot.box(self, by=None, **kwargs)

Parameters:

Name Description Type/Default Value Required / Optional
by             Column in the DataFrame to group by. string or sequence Required
**kwds  Additional keywords are documented in DataFrame.plot().   Required

Returns: matplotlib.axes.Axes or numpy.ndarray of them

Example:


Download the Pandas DataFrame Notebooks from here.

Previous: DataFrame.plot.barh() function
Next: DataFrame-plot-density() function



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/pandas/dataframe/dataframe-plot-box.php