pandas.plotting.boxplot
pandas 3.1.1 · Plotting · function
Draw box plots to compare medians, spread and possible outliers.
Call syntax
pd.plotting.boxplot(…) Full signature
pd.plotting.boxplot(
data,
column=None,
by=None,
ax=None,
fontsize=None,
rot=0,
grid=True,
figsize=None,
layout=None,
return_type=None,
**kwargs,
)Inspect the call
Run this code to inspect the callable and its parameters. Its data, backend, or environment is needed to execute the operation itself.
Parameters
| Parameter | Requirement | Accepted values and behavior |
|---|---|---|
data |
Required Positional or keyword |
DataFrame Provide the input data read, transformed, or stored by this call. |
column |
Optional Positional or keyword Default None |
str or list of str Identify the column or columns to use. |
by |
Optional Positional or keyword Default None |
str or array-like Specify the labels, mapping, or values that determine the sort or grouping. |
ax |
Optional Positional or keyword Default None |
object of class matplotlib.axes.Axes Provide the existing Matplotlib axes on which to draw. |
fontsize |
Optional Positional or keyword Default None |
float or str Set the size of labels or text in the plot. |
rot |
Optional Positional or keyword Default 0 |
float Set the rotation of tick labels in degrees. |
grid |
Optional Positional or keyword Default True |
bool Choose whether the plot displays grid lines. |
figsize |
Optional Positional or keyword Default None |
A tuple (width, height) in inches Set the figure width and height as a pair, in inches. |
layout |
Optional Positional or keyword Default None |
tuple (rows, columns) Set the subplot grid shape as a pair of dimensions. |
return_type |
Optional Positional or keyword Default None |
{'axes', 'dict', 'both'} or None |
**kwargs |
Optional Additional keyword arguments |
Returns
result
Example for a local Python session
import pandas as pd
import matplotlib
frame = pd.DataFrame({"team": ["A", "A", "B"], "units": [2., 5., 7.], "price": [4., 3., 2.]})
print(pd.plotting.boxplot(frame))