pandas.Series.hist

pandas 3.1.1 · Series and accessors · method

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

Call syntax

Series.hist(…) Full signature
Series.hist(
    by=None,
    ax=None,
    grid=True,
    xlabelsize=None,
    xrot=None,
    ylabelsize=None,
    yrot=None,
    figsize=None,
    bins=10,
    backend=None,
    legend=False,
    **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

ParameterRequirementAccepted values and behavior
by Optional
Positional or keyword
Default None
object

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

ax Optional
Positional or keyword
Default None
matplotlib axis object

Provide the existing Matplotlib axes on which to draw.

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
figsize Optional
Positional or keyword
Default None
tuple

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

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.Axes

Example for a local Python session

import pandas as pd
import matplotlib
values = pd.Series([2., 5., 7.], name="units")
print(values.hist())