Skip to content

Commit 91e55c7

Browse files
authored
Update generic.py
1 parent 0c86c86 commit 91e55c7

File tree

1 file changed

+47
-3
lines changed

1 file changed

+47
-3
lines changed

pandas/core/groupby/generic.py

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,6 +1565,14 @@ def corr(
15651565
See Also
15661566
--------
15671567
Series.corr : Equivalent method on ``Series``.
1568+
1569+
1570+
Examples
1571+
--------
1572+
>>> import pandas as pd
1573+
>>> s = pd.Series([1, 2, 3, 4], index=[0, 0, 1, 1])
1574+
>>> g = s.groupby([0, 0, 1, 1])
1575+
>>> g.corr() # doctest: +SKIP
15681576
"""
15691577
result = self._op_via_apply(
15701578
"corr", other=other, method=method, min_periods=min_periods
@@ -1595,6 +1603,13 @@ def cov(
15951603
See Also
15961604
--------
15971605
Series.cov : Equivalent method on ``Series``.
1606+
1607+
Examples
1608+
--------
1609+
>>> import pandas as pd
1610+
>>> s = pd.Series([1, 2, 3, 4], index=[0, 0, 1, 1])
1611+
>>> g = s.groupby([0, 0, 1, 1])
1612+
>>> g.cov() # doctest: +SKIP
15981613
"""
15991614
result = self._op_via_apply(
16001615
"cov", other=other, min_periods=min_periods, ddof=ddof
@@ -1669,9 +1684,31 @@ def hist(
16691684
16701685
Parameters
16711686
----------
1672-
by, ax, grid, xlabelsize, xrot, ylabelsize, yrot, figsize, bins, backend,
1673-
legend, **kwargs
1674-
See :meth:`Series.hist` for full parameter descriptions.
1687+
by : object, optional
1688+
Grouping key.
1689+
ax : matplotlib.axes.Axes, optional
1690+
Axis to draw the histogram on.
1691+
grid : bool, default True
1692+
Show axis grid lines.
1693+
xlabelsize : int, default None
1694+
X axis label size.
1695+
xrot : float, default None
1696+
Rotation for x ticks.
1697+
ylabelsize : int, default None
1698+
Y axis label size.
1699+
yrot : float, default None
1700+
Rotation for y ticks.
1701+
figsize : tuple, optional
1702+
Figure size in inches.
1703+
bins : int or sequence, default 10
1704+
Number of histogram bins or bin edges.
1705+
backend : str or callable or None, optional
1706+
Plotting backend to use (e.g. 'matplotlib'). If None, use the default
1707+
plotting backend.
1708+
legend : bool, default False
1709+
Whether to draw the legend.
1710+
**kwargs
1711+
Additional keyword arguments passed to :meth:`Series.hist`.
16751712
16761713
Returns
16771714
-------
@@ -1681,6 +1718,13 @@ def hist(
16811718
See Also
16821719
--------
16831720
Series.hist : Equivalent histogram plotting method on Series.
1721+
1722+
Examples
1723+
--------
1724+
>>> import pandas as pd
1725+
>>> df = pd.DataFrame({"val": [1, 2, 2, 3, 3, 3]}, index=[0, 0, 1, 1, 2, 2])
1726+
>>> g = df["val"].groupby([0, 0, 1, 1, 2, 2])
1727+
>>> g.hist() # doctest: +SKIP
16841728
"""
16851729
result = self._op_via_apply(
16861730
"hist",

0 commit comments

Comments
 (0)