verticapy.vDataColumn.candlestick#
- vDataColumn.candlestick(ts: str, method: str = 'sum', q: tuple[float, float] = (0.25, 0.75), start_date: bool | float | str | timedelta | datetime | None = None, end_date: bool | float | str | timedelta | datetime | None = None, chart: PlottingBase | TableSample | Axes | mFigure | Highchart | Highstock | Figure | None = None, **style_kwargs) PlottingBase | TableSample | Axes | mFigure | Highchart | Highstock | Figure #
Draws the Time Series of the vDataColumn.
Parameters#
- ts: str
TS (Time Series) vDataColumn used to order the data. The vDataColumn type must be date like (date, datetime, timestamp…) or numerical.
- 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
).- q: tuple, optional
Tuple including the 2 quantiles used to draw the Plot.
- start_date: str / PythonNumber / date, optional
Input Start Date. For example, time = ‘03-11-1993’ will filter the data when ‘ts’ is less than the 3rd of November 1993.
- end_date: str / PythonNumber / date, optional
Input End Date. For example, time = ‘03-11-1993’ will filter the data when ‘ts’ is greater than the 3rd of November 1993.
- 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 Candlestick
Let’s begin by importing VerticaPy.
import verticapy as vp
Let’s also import numpy to create a dataset.
import numpy as np
Let’s generate a dataset using the following data.
data = vp.vDataFrame( { "date": [1990 + i for i in range(N)] * 5, "population": [100 + i for i in range(N)] + [300 + i * 2 for i in range(N)] + [200 + i ** 2 - 3 * i for i in range(N)] + [50 + i ** 2 - 6 * i for i in range(N)] + [700 + i ** 2 - 10 * i for i in range(N)], } )
Now we are ready to draw the plot:
data["population"].candlestick(ts = "date")
See also
vDataFrame.
range_plot()
: Range Plot.vDataColumn.
range_plot()
: Range Plot.