@@ -3049,21 +3049,47 @@ def box(self, by=None, **kwds):
3049
3049
3050
3050
def hist (self , by = None , bins = 10 , ** kwds ):
3051
3051
"""
3052
- Histogram
3052
+ Draw one histogram of the DataFrame's columns.
3053
+
3054
+ A histogram is a representation of the distribution of data.
3055
+ This function groups the values of all given Series in the DataFrame
3056
+ into bins, and draws all bins in only one :ref:`matplotlib.axes.Axes`.
3057
+ This is useful when the DataFrame's Series are in a similar scale.
3053
3058
3054
3059
Parameters
3055
3060
----------
3056
- by : string or sequence
3061
+ by : str or sequence, optional
3057
3062
Column in the DataFrame to group by.
3058
- bins: integer , default 10
3059
- Number of histogram bins to be used
3060
- ` **kwds` : optional
3063
+ bins : int , default 10
3064
+ Number of histogram bins to be used.
3065
+ **kwds
3061
3066
Additional keyword arguments are documented in
3062
3067
:meth:`pandas.DataFrame.plot`.
3063
3068
3064
3069
Returns
3065
3070
-------
3066
- axes : :class:`matplotlib.axes.Axes` or numpy.ndarray of them
3071
+ axes : matplotlib.AxesSubplot histogram.
3072
+
3073
+ See Also
3074
+ --------
3075
+ DataFrame.hist : Draw histograms per DataFrame's Series.
3076
+ Series.hist : Draw a histogram with Series' data.
3077
+
3078
+ Examples
3079
+ --------
3080
+ When we draw a dice 6000 times, we expect to get each value around 1000
3081
+ times. But when we draw two dices and sum the result, the distribution
3082
+ is going to be quite different. A histogram illustrates those
3083
+ distributions.
3084
+
3085
+ .. plot::
3086
+ :context: close-figs
3087
+
3088
+ >>> df = pd.DataFrame(
3089
+ ... np.random.randint(1, 7, 6000),
3090
+ ... columns = ['one'])
3091
+ >>> df['two'] = df['one'] + np.random.randint(1, 7, 6000)
3092
+ >>> ax = df.plot.hist(bins=12, alpha=0.5)
3067
3093
"""
3068
3094
return self (kind = 'hist' , by = by , bins = bins , ** kwds )
3069
3095
0 commit comments