pandas.api.typing.DataFrameGroupBy.hist

pandas 3.1.1 · GroupBy · method

Draw histograms to show how numeric observations are distributed across bins.

Call syntax

pd.api.typing.DataFrameGroupBy.hist(…) Full signature
pd.api.typing.DataFrameGroupBy.hist(
    column=None,
    by=None,
    grid=True,
    xlabelsize=None,
    xrot=None,
    ylabelsize=None,
    yrot=None,
    ax=None,
    sharex=False,
    sharey=False,
    figsize=None,
    layout=None,
    bins=10,
    backend=None,
    legend=False,
    **kwargs,
)

Run the example

Edit the example and select Run Python to see the result.

Parameters

ParameterRequirementAccepted values and behavior
column Optional
Positional or keyword
Default None
str or sequence

Identify the column or columns to use.

by Optional
Positional or keyword
Default None
object

Specify the labels, mapping, or values that determine the sort or grouping.

grid Optional
Positional or keyword
Default True
bool

Choose whether the plot displays grid lines.

xlabelsize Optional
Positional or keyword
Default None
int

Set the size of horizontal-axis tick labels.

xrot Optional
Positional or keyword
Default None
float
ylabelsize Optional
Positional or keyword
Default None
int

Set the size of vertical-axis tick labels.

yrot Optional
Positional or keyword
Default None
float
ax Optional
Positional or keyword
Default None
Matplotlib axes object

Provide the existing Matplotlib axes on which to draw.

sharex Optional
Positional or keyword
Default False
bool

Choose whether subplots share their horizontal axis.

sharey Optional
Positional or keyword
Default False
bool

Choose whether subplots share their vertical axis.

figsize Optional
Positional or keyword
Default None
tuple

Set the figure width and height as a pair, in inches.

layout Optional
Positional or keyword
Default None
tuple

Set the subplot grid shape as a pair of dimensions.

bins Optional
Positional or keyword
Default 10
int or sequence

Set a number of bins or provide bin boundaries.

backend Optional
Positional or keyword
Default None
str
legend Optional
Positional or keyword
Default False
bool

Choose whether to display a legend.

**kwargs Optional
Additional keyword arguments

Returns

matplotlib.Axes or numpy.ndarray