deephaven.agg¶
- class Aggregation(j_agg_spec=None, j_aggregation=None, cols=None)[source]¶
Bases:
object
An Aggregation object represents an aggregation operation.
Note: It should not be instantiated directly by user code but rather through the static methods on the class.
- abs_sum(cols=None)[source]¶
Create an Absolute-sum aggregation.
- Parameters
cols (Union[str, List[str]]) – the column(s) to aggregate on, can be renaming expressions, i.e. “new_col = col”; default is None, only valid when used in Table agg_all_by operation
- Return type
- Returns
an aggregation
- avg(cols=None)[source]¶
Create an Average aggregation.
- Parameters
cols (Union[str, List[str]]) – the column(s) to aggregate on, can be renaming expressions, i.e. “new_col = col”; default is None, only valid when used in Table agg_all_by operation
- Return type
- Returns
an aggregation
- count_(col)[source]¶
Create a Count aggregation. This is not supported in ‘Table.agg_all_by’.
- Parameters
col (str) – the column to hold the counts of each distinct group
- Return type
- Returns
an aggregation
- count_distinct(cols=None)[source]¶
Create a Count Distinct aggregation.
- Parameters
cols (Union[str, List[str]]) – the column(s) to aggregate on, can be renaming expressions, i.e. “new_col = col”; default is None, only valid when used in Table agg_all_by operation
- Return type
- Returns
an aggregation
- first(cols=None)[source]¶
Create a First aggregation.
- Parameters
cols (Union[str, List[str]]) – the column(s) to aggregate on, can be renaming expressions, i.e. “new_col = col”; default is None, only valid when used in Table agg_all_by operation
- Return type
- Returns
an aggregation
- formula(formula, formula_param, cols=None)[source]¶
Create a user defined formula aggregation.
- Parameters
formula (str) – the user defined formula to apply to each group
formula_param (str) – the parameter name within the formula
cols (Union[str, List[str]]) – the column(s) to aggregate on, can be renaming expressions, i.e. “new_col = col”; default is None, only valid when used in Table agg_all_by operation
- Return type
- Returns
an aggregation
- group(cols=None)[source]¶
Create a Group aggregation.
- Parameters
cols (Union[str, List[str]]) – the column(s) to aggregate on, can be renaming expressions, i.e. “new_col = col”; default is None, only valid when used in Table agg_all_by operation
- Return type
- Returns
an aggregation
- last(cols=None)[source]¶
Create Last aggregation.
- Parameters
cols (Union[str, List[str]]) – the column(s) to aggregate on, can be renaming expressions, i.e. “new_col = col”; default is None, only valid when used in Table agg_all_by operation
- Return type
- Returns
an aggregation
- max_(cols=None)[source]¶
Create a Max aggregation to the ComboAggregation object.
- Parameters
cols (Union[str, List[str]]) – the column(s) to aggregate on, can be renaming expressions, i.e. “new_col = col”; default is None, only valid when used in Table agg_all_by operation
- Return type
- Returns
an aggregation
- median(cols=None)[source]¶
Create a Median aggregation.
- Parameters
cols (Union[str, List[str]]) – the column(s) to aggregate on, can be renaming expressions, i.e. “new_col = col”; default is None, only valid when used in Table agg_all_by operation
- Return type
- Returns
an aggregation
- min_(cols=None)[source]¶
Create a Min aggregation.
- Parameters
cols (Union[str, List[str]]) – the column(s) to aggregate on, can be renaming expressions, i.e. “new_col = col”; default is None, only valid when used in Table agg_all_by operation
- Return type
- Returns
an aggregation
- partition(col, include_by_columns=True)[source]¶
Create a Partition aggregation. This is not supported in ‘Table.agg_all_by’.
- Parameters
col (str) – the column to hold the sub tables
include_by_columns (bool) – whether to include the group by columns in the result, default is True
- Return type
- Returns
an aggregation
- pct(percentile, cols=None)[source]¶
Create a Percentile aggregation.
- Parameters
percentile (float) – the percentile used for calculation
cols (Union[str, List[str]]) – the column(s) to aggregate on, can be renaming expressions, i.e. “new_col = col”; default is None, only valid when used in Table agg_all_by operation
- Return type
- Returns
an aggregation
- sorted_first(order_by, cols=None)[source]¶
Create a SortedFirst aggregation.
- Parameters
order_by (str) – the column to sort by
cols (Union[str, List[str]]) – the column(s) to aggregate on, can be renaming expressions, i.e. “new_col = col”; default is None, only valid when used in Table agg_all_by operation
- Return type
- Returns
an aggregation
- sorted_last(order_by, cols=None)[source]¶
Create a SortedLast aggregation.
- Parameters
order_by (str) – the column to sort by
cols (Union[str, List[str]]) – the column(s) to aggregate on, can be renaming expressions, i.e. “new_col = col”; default is None, only valid when used in Table agg_all_by operation
- Return type
- Returns
an aggregation
- std(cols=None)[source]¶
Create a Std aggregation.
- Parameters
cols (Union[str, List[str]]) – the column(s) to aggregate on, can be renaming expressions, i.e. “new_col = col”; default is None, only valid when used in Table agg_all_by operation
- Return type
- Returns
an aggregation
- sum_(cols=None)[source]¶
Create a Sum aggregation.
- Parameters
cols (Union[str, List[str]]) – the column(s) to aggregate on, can be renaming expressions, i.e. “new_col = col”; default is None, only valid when used in Table agg_all_by operation
- Return type
- Returns
an aggregation
- unique(cols=None)[source]¶
Create a Unique aggregation.
- Parameters
cols (Union[str, List[str]]) – the column(s) to aggregate on, can be renaming expressions, i.e. “new_col = col”; default is None, only valid when used in Table agg_all_by operation
- Return type
- Returns
an aggregation
- var(cols=None)[source]¶
Create a Var aggregation.
- Parameters
cols (Union[str, List[str]]) – the column(s) to aggregate on, can be renaming expressions, i.e. “new_col = col”; default is None, only valid when used in Table agg_all_by operation
- Return type
- Returns
an aggregation
- weighted_avg(wcol, cols=None)[source]¶
Create a Weighted-avg aggregation.
- Parameters
wcol (str) – the name of the weight column
cols (Union[str, List[str]]) – the column(s) to aggregate on, can be renaming expressions, i.e. “new_col = col”; default is None, only valid when used in Table agg_all_by operation
- Return type
- Returns
an aggregation
- weighted_sum(wcol, cols=None)[source]¶
Create a Weighted-sum aggregation.
- Parameters
wcol (str) – the name of the weight column
cols (Union[str, List[str]]) – the column(s) to aggregate on, can be renaming expressions, i.e. “new_col = col”; default is None, only valid when used in Table agg_all_by operation
- Return type
- Returns
an aggregation