
verticapy.vDataColumn.density¶
- vDataColumn.density(by: str | None = None, bandwidth: Annotated[int | float | Decimal, 'Python Numbers'] = 1.0, kernel: Literal['gaussian', 'logistic', 'sigmoid', 'silverman'] = 'gaussian', nbins: int = 200, xlim: tuple[float, float] | None = None, chart: PlottingBase | TableSample | Axes | mFigure | Highchart | Highstock | Figure | None = None, **style_kwargs) PlottingBase | TableSample | Axes | mFigure | Highchart | Highstock | Figure ¶
Draws the vDataColumn Density Plot.
Parameters¶
- by: str, optional
vDataColumn used to partition the data.
- bandwidth: PythonNumber, optional
The bandwidth of the kernel.
- kernel: str, optional
- The method used for the plot.
gaussian : Gaussian kernel. logistic : Logistic kernel. sigmoid : Sigmoid kernel. silverman : Silverman kernel.
- nbins: int, optional
Maximum number of points used to evaluate the approximate density function. Increasing this parameter increases the precision but also increases the time of the learning and scoring phases.
- xlim: tuple, optional
Set the x limits of the current axes.
- 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 Density
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"].density()
See also
vDataFrame.
density()
: Density Plot.vDataFrame.
range_plot()
: Range Plot.vDataColumn.
hist()
: Histogram.