verticapy.vDataColumn.hist#
- vDataColumn.hist(by: str | None = None, method: str = 'density', of: str | None = None, h: int | float | Decimal | None = None, h_by: int | float | Decimal = 0, max_cardinality: int = 8, cat_priority: None | bool | float | str | timedelta | datetime | list | ndarray = None, chart: PlottingBase | TableSample | Axes | mFigure | Highchart | Highstock | Figure | None = None, **style_kwargs) PlottingBase | TableSample | Axes | mFigure | Highchart | Highstock | Figure #
Draws the histogram of the input vDataColumn based on an aggregation.
Parameters#
- by: str, optional
vDataColumn used to partition the data.
- method: str, optional
The method used to aggregate the data.
- count:
Number of elements.
- density:
Percentage of the distribution.
- mean:
Average of the
vDataColumns
of
.
- min:
Minimum of the
vDataColumns
of
.
- max:
Maximum of the
vDataColumns
of
.
- sum:
Sum of the
vDataColumns
of
.
- q%:
q Quantile of the
vDataColumns
of
(ex: 50% to get the median).
It can also be a cutomized aggregation (ex: AVG(column1) + 5).
- of: str, optional
The vDataColumn used to compute the aggregation.
- h: PythonNumber, optional
Interval width of the input vDataColumns. Optimized h will be computed if the parameter is empty or invalid.
- h_by: PythonNumber, optional
Interval width if the ‘by’ vDataColumn is numerical or of a date-like type. Optimized h will be computed if the parameter is empty or invalid.
- max_cardinality: int, optional
Maximum number of distinct elements for vDataColumns to be used as categorical. The less frequent elements are gathered together to create a new category : ‘Others’. This parameter is used to discretize the vDataColumn ‘by’ when the main input nvDataColumn is nnumerical. Otherwise, it is used to discretize all the vDataColumn inputs.
- cat_priority: PythonScalar / ArrayLike, optional
ArrayLike list of the different categories to consider when drawing the box plot. The other categories are filtered.
- chart: PlottingObject, optional
The chart object to plot on.
- **style_kwargs
Any optional parameter to pass to the plotting functions.
Returns#
- obj
Plotting Object.
Examples#
Note
The below example is a very basic one. For other more detailed examples and customization options, please see Histogram
Let’s begin by importing VerticaPy.
import verticapy as vp
Let’s also import numpy to create a dataset.
import numpy as np
We can create a variable
N
to fix the size:N = 50
Let’s generate a dataset using the following data.
data = vp.vDataFrame( { "score1": np.random.normal(5, 1, N), } )
Now we are ready to draw the plot:
data["score1"].hist()