histogram(col, y=None, n_bins=10, col_max=None, col_min=None, normalized=False, figargs=None)¶
Creates a histogram. This function takes a single input and creates a histogram from it. There is an optional second column input for labels, if you would like to see how a label is distributed relative to your numeric variable.
- col (pd.Series) – The column from which to make a histogram.
- y (pd.Series, optional) – A binary label that you would like to track.
- n_bins (int) – The number of bins of the histogram. Default is 10.
- col_max (float) – Maximum value to include in histogram.
- col_min (float) – Minimum value to include in histogram.
- normalized (bool) – Whether or not to normalize the columns. Default is False.
If the dataframe
Xhas a column named
amountand a label
y, you can compare them with
>>> import henchman.plotting as hplot >>> plot1 = hplot.histogram(X['amount'], y, normalized=False) >>> hplot.show(plot1)
If you wanted a single variable histogram instead, omit y:
>>> plot2 = hplot.histogram(X['amount'], col_max=200, n_bins=20) >>> hplot.show(plot2)