vastorbit.VastFrame.analytic¶
- VastFrame.analytic(func: str, columns: Annotated[str | list[str], 'STRING representing one column or a list of columns'] | None = None, by: Annotated[str | list[str], 'STRING representing one column or a list of columns'] | None = None, order_by: None | Annotated[str | list[str], 'STRING representing one column or a list of columns'] | dict = None, name: str | None = None, offset: int = 1, add_count: bool = True) VastFrame¶
Adds a new VastColumn to the VastFrame by using an advanced analytical function on one or two specific VastColumns.
- Parameters:
func (str) –
Function to apply. Available functions:
Statistical: - aad: average absolute deviation - kurtosis: kurtosis - skewness: skewness - mad: median absolute deviation - jb: Jarque-Bera index - iqr: interquartile range - sem: standard error of the mean - range: max - min
Aggregates: - max, min, avg, sum, count - stddev, variance - median: approximate median (using approx_percentile) - mode: most frequent element - prod: product - unique: cardinality - q%: q quantile (e.g., 50% for median)
Window: - lead, lag: next/previous element - first_value, last_value - row_number, rank, dense_rank, percent_rank - pct_change: ratio between current and previous
Correlation: - corr: Pearson correlation - cov: covariance - beta: Beta coefficient
columns (SQLColumns, optional) – Input VastColumns (1 or 2 elements).
by (SQLColumns, optional) – Partition columns.
order_by (dict / list, optional) – Sort order.
name (str, optional) – Name of new column.
offset (int, optional) – Lead/Lag offset (default: 1).
add_count (bool, optional) – For mode: add count column.
- Returns:
self
- Return type: