@@ -2595,7 +2595,6 @@ def cov(
2595
2595
)
2596
2596
return result
2597
2597
2598
- @doc (DataFrame .hist .__doc__ )
2599
2598
def hist (
2600
2599
self ,
2601
2600
column : IndexLabel | None = None ,
@@ -2615,6 +2614,92 @@ def hist(
2615
2614
legend : bool = False ,
2616
2615
** kwargs ,
2617
2616
):
2617
+ """
2618
+ Make a histogram of the DataFrame's columns.
2619
+
2620
+ A `histogram`_ is a representation of the distribution of data.
2621
+ This function calls :meth:`matplotlib.pyplot.hist`, on each series in
2622
+ the DataFrame, resulting in one histogram per column.
2623
+
2624
+ .. _histogram: https://en.wikipedia.org/wiki/Histogram
2625
+
2626
+ Parameters
2627
+ ----------
2628
+ column : str or sequence, optional
2629
+ If passed, will be used to limit data to a subset of columns.
2630
+ by : object, optional
2631
+ If passed, then used to form histograms for separate groups.
2632
+ grid : bool, default True
2633
+ Whether to show axis grid lines.
2634
+ xlabelsize : int, default None
2635
+ If specified changes the x-axis label size.
2636
+ xrot : float, default None
2637
+ Rotation of x axis labels. For example, a value of 90 displays the
2638
+ x labels rotated 90 degrees clockwise.
2639
+ ylabelsize : int, default None
2640
+ If specified changes the y-axis label size.
2641
+ yrot : float, default None
2642
+ Rotation of y axis labels. For example, a value of 90 displays the
2643
+ y labels rotated 90 degrees clockwise.
2644
+ ax : Matplotlib axes object, default None
2645
+ The axes to plot the histogram on.
2646
+ sharex : bool, default True if ax is None else False
2647
+ In case subplots=True, share x axis and set some x axis labels to
2648
+ invisible; defaults to True if ax is None otherwise False if an ax
2649
+ is passed in.
2650
+ Note that passing in both an ax and sharex=True will alter all x axis
2651
+ labels for all subplots in a figure.
2652
+ sharey : bool, default False
2653
+ In case subplots=True, share y axis and set some y axis labels to
2654
+ invisible.
2655
+ figsize : tuple, optional
2656
+ The size in inches of the figure to create. Uses the value in
2657
+ `matplotlib.rcParams` by default.
2658
+ layout : tuple, optional
2659
+ Tuple of (rows, columns) for the layout of the histograms.
2660
+ bins : int or sequence, default 10
2661
+ Number of histogram bins to be used. If an integer is given, bins + 1
2662
+ bin edges are calculated and returned. If bins is a sequence, gives
2663
+ bin edges, including left edge of first bin and right edge of last
2664
+ bin. In this case, bins is returned unmodified.
2665
+
2666
+ backend : str, default None
2667
+ Backend to use instead of the backend specified in the option
2668
+ ``plotting.backend``. For instance, 'matplotlib'. Alternatively, to
2669
+ specify the ``plotting.backend`` for the whole session, set
2670
+ ``pd.options.plotting.backend``.
2671
+
2672
+ legend : bool, default False
2673
+ Whether to show the legend.
2674
+
2675
+ **kwargs
2676
+ All other plotting keyword arguments to be passed to
2677
+ :meth:`matplotlib.pyplot.hist`.
2678
+
2679
+ Returns
2680
+ -------
2681
+ matplotlib.Axes or numpy.ndarray of them
2682
+
2683
+ See Also
2684
+ --------
2685
+ matplotlib.pyplot.hist : Plot a histogram using matplotlib.
2686
+
2687
+ Examples
2688
+ --------
2689
+ This example draws a histogram based on the length and width of
2690
+ some animals, displayed in three bins
2691
+
2692
+ .. plot::
2693
+ :context: close-figs
2694
+
2695
+ >>> data = {
2696
+ ... "length": [1.5, 0.5, 1.2, 0.9, 3],
2697
+ ... "width": [0.7, 0.2, 0.15, 0.2, 1.1],
2698
+ ... }
2699
+ >>> index = ["pig", "rabbit", "duck", "chicken", "horse"]
2700
+ >>> df = pd.DataFrame(data, index=index)
2701
+ >>> hist = df.groupby("length").hist(bins=3)
2702
+ """
2618
2703
result = self ._op_via_apply (
2619
2704
"hist" ,
2620
2705
column = column ,
0 commit comments