datascience.tables.Table.hist¶
-
Table.
hist
(select=None, overlay=True, bins=None, counts=None, unit=None, **vargs)[source]¶ Plots one histogram for each column in the table.
Every column must be numerical.
- Kwargs:
- overlay (bool): If True, plots 1 chart with all the histograms
- overlaid on top of each other (instead of the default behavior of one histogram for each column in the table). Also adds a legend that matches each bar color to its column.
- bins (column name or list): Lower bound for each bin in the
- histogram. If None, bins will be chosen automatically.
- counts (column name or column): A column of counted values.
- All other columns are treated as counts of these values. If None, each value in each row is assigned a count of 1.
- vargs: Additional arguments that get passed into :func:plt.hist.
- See http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.hist for additional arguments that can be passed into vargs. These include: range, normed, cumulative, and orientation, to name a few.
>>> t = Table().with_columns([ ... 'count', [9, 3, 3, 1], ... 'points', [1, 2, 2, 10]]) >>> t count | points 9 | 1 3 | 2 3 | 2 1 | 10 >>> t.hist() <histogram of values in count> <histogram of values in points>
>>> t = Table().with_columns([ ... 'value', [101, 102, 103], ... 'proportion', [0.25, 0.5, 0.25]]) >>> t.hist(counts='value') <histogram of values in prop weighted by corresponding values in value>