hist(self, by=None, bins=10, **kwargs)
A histogram is a representation of the distribution of data. This function groups the values of all given Series in the DataFrame into bins and draws all bins in one matplotlib.axes.Axes
. This is useful when the DataFrame's Series are in a similar scale.
Column in the DataFrame to group by.
Previously, :None:None:`by`
is silently ignore and makes no groupings
Number of histogram bins to be used.
Additional keyword arguments are documented in DataFrame.plot
.
Return a histogram plot.
Draw one histogram of the DataFrame's columns.
DataFrame.hist
Draw histograms per DataFrame's Series.
Series.hist
Draw a histogram with Series' data.
When we roll a die 6000 times, we expect to get each value around 1000 times. But when we roll two dice and sum the result, the distribution is going to be quite different. A histogram illustrates those distributions.
.. plot:: ('context', 'close-figs')
>>> df = pd.DataFrame( ... np.random.randint(1, 7, 6000), ... columns = ['one']) >>> df['two'] = df['one'] + np.random.randint(1, 7, 6000) >>> ax = df.plot.hist(bins=12, alpha=0.5)
A grouped histogram can be generated by providing the parameter :None:None:`by`
(which can be a column name, or a list of column names):
.. plot:: ('context', 'close-figs')
See :>>> age_list = [8, 10, 12, 14, 72, 74, 76, 78, 20, 25, 30, 35, 60, 85] >>> df = pd.DataFrame({"gender": list("MMMMMMMMFFFFFF"), "age": age_list}) >>> ax = df.plot.hist(column=["age"], by="gender", figsize=(10, 8))
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them