Skip to content

Commit 5f4cd4d

Browse files
committed
DOC: change hist docstring to inline from @doc for SeriesGroupBy
1 parent 8ad1c54 commit 5f4cd4d

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

pandas/core/groupby/generic.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2381,6 +2381,72 @@ def hist(
23812381
legend: bool = False,
23822382
**kwargs,
23832383
):
2384+
"""
2385+
Draw histogram of the input series using matplotlib.
2386+
2387+
Parameters
2388+
----------
2389+
by : object, optional
2390+
If passed, then used to form histograms for separate groups.
2391+
ax : matplotlib axis object
2392+
If not passed, uses gca().
2393+
grid : bool, default True
2394+
Whether to show axis grid lines.
2395+
xlabelsize : int, default None
2396+
If specified changes the x-axis label size.
2397+
xrot : float, default None
2398+
Rotation of x axis labels.
2399+
ylabelsize : int, default None
2400+
If specified changes the y-axis label size.
2401+
yrot : float, default None
2402+
Rotation of y axis labels.
2403+
figsize : tuple, default None
2404+
Figure size in inches by default.
2405+
bins : int or sequence, default 10
2406+
Number of histogram bins to be used. If an integer is given, bins + 1
2407+
bin edges are calculated and returned. If bins is a sequence, gives
2408+
bin edges, including left edge of first bin and right edge of last
2409+
bin. In this case, bins is returned unmodified.
2410+
backend : str, default None
2411+
Backend to use instead of the backend specified in the option
2412+
``plotting.backend``. For instance, 'matplotlib'. Alternatively, to
2413+
specify the ``plotting.backend`` for the whole session, set
2414+
``pd.options.plotting.backend``.
2415+
legend : bool, default False
2416+
Whether to show the legend.
2417+
2418+
**kwargs
2419+
To be passed to the actual plotting function.
2420+
2421+
Returns
2422+
-------
2423+
matplotlib.axes.Axes
2424+
A histogram plot.
2425+
2426+
See Also
2427+
--------
2428+
matplotlib.axes.Axes.hist : Plot a histogram using matplotlib.
2429+
2430+
Examples
2431+
--------
2432+
For Series:
2433+
2434+
.. plot::
2435+
:context: close-figs
2436+
2437+
>>> lst = ["a", "a", "a", "b", "b", "b"]
2438+
>>> ser = pd.Series([1, 2, 2, 4, 6, 6], index=lst)
2439+
>>> hist = ser.hist()
2440+
2441+
For Groupby:
2442+
2443+
.. plot::
2444+
:context: close-figs
2445+
2446+
>>> lst = ["a", "a", "a", "b", "b", "b"]
2447+
>>> ser = pd.Series([1, 2, 2, 4, 6, 6], index=lst)
2448+
>>> hist = ser.groupby(level=0).hist()
2449+
"""
23842450
result = self._op_via_apply(
23852451
"hist",
23862452
by=by,

0 commit comments

Comments
 (0)