vastorbit.VastFrame.hist¶
- VastFrame.hist(columns: Annotated[str | list[str], 'STRING representing one column or a list of columns'], method: Literal[None, 'density', 'count', 'avg', 'min', 'max', 'sum'] | str = 'density', of: str | None = None, h: Annotated[int | float | Decimal, 'Python Numbers'] | None = None, chart: PlottingBase | TableSample | Axes | mFigure | Figure | None = None, **style_kwargs) PlottingBase | TableSample | Axes | mFigure | Figure¶
Draws the histograms of the input VastColumns based on an aggregation.
- Parameters:
columns (SQLColumns) –
listof theVastColumnsnames. Thelistmust have less than 5 elements.method (str, optional) –
The method used to aggregate the data.
- count:
Number of elements.
- density:
Percentage of the distribution.
- mean:
Average of the
VastColumnsof.
- min:
Minimum of the
VastColumnsof.
- max:
Maximum of the
VastColumnsof.
- sum:
Sum of the
VastColumnsof.
- q%:
q Quantile of the
VastColumnsof(ex: 50% to get the median).
It can also be a cutomized aggregation, for example:
AVG(column1) + 5of (str, optional) – The
VastColumnsused to compute the aggregation.h (tuple, optional) – Interval width of the input VastColumns. Optimized h will be computed if the parameter is empty or invalid.
chart (PlottingObject, optional) – The chart object to plot on.
**style_kwargs – Any optional parameter to pass to the plotting functions.
- Returns:
Plotting Object.
- Return type:
obj
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 vastorbit.
import vastorbit as vo
Let’s also import numpy to create a dataset.
import numpy as np
We can create a variable
Nto fix the size:N = 50
Let’s generate a dataset using the following data.
data = vo.VastFrame( { "score1": np.random.normal(5, 1, N), "score2": np.random.normal(8, 1.5, N), "score3": np.random.normal(10, 2, N), } )
Below are examples of two types of hist plots:
Single
Multi
data.hist(["score1"])
data.hist(columns = ["score1", "score2"])