DataFrame<R, C>.Aggregate Method

Definition

Namespace: Numerics.NET.DataAnalysis
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.9.0

Overload List

Aggregate<COut>(Aggregation<C, COut>[]) Aggregates selected columns using typed aggregation descriptors.
Aggregate<T>(AggregatorGroup<T>) Applies the specified aggregator to all the columns in the data frame.
Aggregate<T>(AggregatorGroup<T>[]) Applies the specified aggregators to all the columns in the data frame.
Aggregate<COut>(IEnumerable<Aggregation<C, COut>>) Aggregates selected columns using typed aggregation descriptors.
Aggregate<T, TResult>(Func<Vector<T>, TResult>) Applies the specified aggregators to all the columns in the data frame.
Aggregate<TKey, COut>(Grouping<TKey>, Aggregation<C, COut>[]) Aggregates selected columns over an existing grouping using typed aggregation descriptors.
Aggregate<TKey, COut>(Grouping<TKey>, IEnumerable<Aggregation<C, COut>>) Aggregates selected columns over an existing grouping using typed aggregation descriptors.
Aggregate<TKey, COut>(GroupingTemplate<TKey>, Aggregation<C, COut>[]) Aggregates selected columns over a grouping template using typed aggregation descriptors.
Aggregate<TKey, COut>(GroupingTemplate<TKey>, IEnumerable<Aggregation<C, COut>>) Aggregates selected columns over a grouping template using typed aggregation descriptors.
Aggregate<T1, T2, TResult>(Func<Vector<T1>, TResult>, Func<Vector<T2>, TResult>) Applies the specified aggregators to all the columns in the data frame.
Aggregate<T1, T2, T3, TResult>(Func<Vector<T1>, TResult>, Func<Vector<T2>, TResult>, Func<Vector<T3>, TResult>) Applies the specified aggregators to all the columns in the data frame.

Aggregate<COut>(Aggregation<C, COut>[])

Aggregates selected columns using typed aggregation descriptors.
C#
public DataFrame<long, COut> Aggregate<COut>(
	params Aggregation<C, COut>[] aggregations
)

Parameters

aggregations  Aggregation<C, COut>[]
The aggregation descriptors to bind and execute.

Type Parameters

COut
The type of the result dataframe column keys.

Return Value

DataFrame<Int64, COut>
A one-row data frame with the descriptor output keys as column keys.

Remarks

Ungrouped descriptor aggregation is treated as aggregation over one implicit group containing all rows. The returned data frame uses a default one-row index. All descriptors supplied to one call must share the same output key type.

The standard descriptor factories produce string output keys by default. Use Aggregation<C, COut>.As(...) to choose a custom output key type.

Exceptions

ArgumentNullException

aggregations is null.

-or-

One of the descriptors in aggregations is null.

InvalidOperationException An aggregation cannot be applied to one of the selected columns, or duplicate output keys are produced.

Aggregate<T>(AggregatorGroup<T>)

Applies the specified aggregator to all the columns in the data frame.
C#
public Vector<T> Aggregate<T>(
	AggregatorGroup<T> aggregator
)

Parameters

aggregator  AggregatorGroup<T>
The aggregator to use.

Type Parameters

T
The type of the result of the aggregation.

Return Value

Vector<T>
A vector that contains the result of the aggregations indexed by the data frame's column index.

Aggregate<T>(AggregatorGroup<T>[])

Applies the specified aggregators to all the columns in the data frame.
C#
public DataFrame<string, C> Aggregate<T>(
	params AggregatorGroup<T>[] aggregators
)

Parameters

aggregators  AggregatorGroup<T>[]
One or more aggregators to use.

Type Parameters

T
The type of the result of the aggregation.

Return Value

DataFrame<String, C>
A new data frame that contains the result of the aggregations with rows indexed by the names of the aggregators and columns indexed by the data frame's column index.

Aggregate<T, TResult>(Func<Vector<T>, TResult>)

Applies the specified aggregators to all the columns in the data frame.
C#
public Vector<TResult> Aggregate<T, TResult>(
	Func<Vector<T>, TResult> aggregator
)

Parameters

aggregator  Func<Vector<T>, TResult>
One or more aggregators to use.

Type Parameters

T
The element type of the input to the aggregation.
TResult
The type of the result of the aggregation.

Return Value

Vector<TResult>
A new data frame that contains the result of the aggregations with rows indexed by the names of the aggregators and columns indexed by the data frame's column index.

Aggregate<COut>(IEnumerable<Aggregation<C, COut>>)

Aggregates selected columns using typed aggregation descriptors.
C#
public DataFrame<long, COut> Aggregate<COut>(
	IEnumerable<Aggregation<C, COut>> aggregations
)

Parameters

aggregations  IEnumerable<Aggregation<C, COut>>
The aggregation descriptors to bind and execute.

Type Parameters

COut
The type of the result dataframe column keys.

Return Value

DataFrame<Int64, COut>
A one-row data frame with the descriptor output keys as column keys.

Remarks

Descriptors are resolved against a current schema snapshot and translated into an output column index plus simple execution bindings. Selector resolution uses schema metadata only and does not inspect vector values.

Duplicate descriptor output keys are invalid. The standard descriptor factories produce string output keys by default; use Aggregation<C, COut>.As(...) to choose a custom output key type.

Exceptions

ArgumentNullException

aggregations is null.

-or-

One of the descriptors in aggregations is null.

InvalidOperationException An aggregation cannot be applied to one of the selected columns, or duplicate output keys are produced.

Aggregate<T1, T2, TResult>(Func<Vector<T1>, TResult>, Func<Vector<T2>, TResult>)

Applies the specified aggregators to all the columns in the data frame.
C#
public DataFrame<string, C> Aggregate<T1, T2, TResult>(
	Func<Vector<T1>, TResult> aggregator1,
	Func<Vector<T2>, TResult> aggregator2
)

Parameters

aggregator1  Func<Vector<T1>, TResult>
A function that aggregates multiple values into one.
aggregator2  Func<Vector<T2>, TResult>
A function that aggregates multiple values into one.

Type Parameters

T1
The element type of the input to aggregator1
T2
The element type of the input to aggregator2
TResult
The type of the result of the aggregation.

Return Value

DataFrame<String, C>
A new data frame that contains the result of the aggregations with rows indexed by the names of the aggregators and columns indexed by the data frame's column index.

Aggregate<TKey, COut>(Grouping<TKey>, Aggregation<C, COut>[])

Aggregates selected columns over an existing grouping using typed aggregation descriptors.
C#
public DataFrame<TKey, COut> Aggregate<TKey, COut>(
	Grouping<TKey> grouping,
	params Aggregation<C, COut>[] aggregations
)

Parameters

grouping  Grouping<TKey>
The realized grouping to aggregate over.
aggregations  Aggregation<C, COut>[]
The aggregation descriptors to bind and execute.

Type Parameters

TKey
The type of the group keys.
COut
The type of the result dataframe column keys.

Return Value

DataFrame<TKey, COut>
A data frame whose row index is the grouping index and whose column keys are descriptor output keys.

Remarks

The aggregation descriptors are resolved against a current schema snapshot, then executed using the existing aggregator infrastructure. The result row index is grouping's index.

Duplicate descriptor output keys are invalid. The standard descriptor factories produce string output keys by default; use Aggregation<C, COut>.As(...) to choose a custom output key type.

Exceptions

ArgumentNullException

grouping is null.

-or-

aggregations is null.

-or-

One of the descriptors in aggregations is null.

InvalidOperationException An aggregation cannot be applied to one of the selected columns, or duplicate output keys are produced.

Aggregate<TKey, COut>(Grouping<TKey>, IEnumerable<Aggregation<C, COut>>)

Aggregates selected columns over an existing grouping using typed aggregation descriptors.
C#
public DataFrame<TKey, COut> Aggregate<TKey, COut>(
	Grouping<TKey> grouping,
	IEnumerable<Aggregation<C, COut>> aggregations
)

Parameters

grouping  Grouping<TKey>
The realized grouping to aggregate over.
aggregations  IEnumerable<Aggregation<C, COut>>
The aggregation descriptors to bind and execute.

Type Parameters

TKey
The type of the group keys.
COut
The type of the result dataframe column keys.

Return Value

DataFrame<TKey, COut>
A data frame whose row index is the grouping index and whose column keys are descriptor output keys.

Exceptions

ArgumentNullException

grouping is null.

-or-

aggregations is null.

-or-

One of the descriptors in aggregations is null.

InvalidOperationException An aggregation cannot be applied to one of the selected columns, or duplicate output keys are produced.

Aggregate<TKey, COut>(GroupingTemplate<TKey>, Aggregation<C, COut>[])

Aggregates selected columns over a grouping template using typed aggregation descriptors.
C#
public DataFrame<TKey, COut> Aggregate<TKey, COut>(
	GroupingTemplate<TKey> grouping,
	params Aggregation<C, COut>[] aggregations
)

Parameters

grouping  GroupingTemplate<TKey>
The grouping template to bind to this data frame.
aggregations  Aggregation<C, COut>[]
The aggregation descriptors to bind and execute.

Type Parameters

TKey
The type of the group keys.
COut
The type of the result dataframe column keys.

Return Value

DataFrame<TKey, COut>
A data frame whose row index is the bound grouping index and whose column keys are descriptor output keys.

Remarks

The template is bound to this data frame and the resulting realized grouping is passed to the corresponding realized-grouping descriptor aggregation overload.

Exceptions

ArgumentNullException

grouping is null.

-or-

aggregations is null.

-or-

One of the descriptors in aggregations is null.

InvalidOperationException The template cannot be bound, an aggregation cannot be applied to one of the selected columns, or duplicate output keys are produced.

Aggregate<TKey, COut>(GroupingTemplate<TKey>, IEnumerable<Aggregation<C, COut>>)

Aggregates selected columns over a grouping template using typed aggregation descriptors.
C#
public DataFrame<TKey, COut> Aggregate<TKey, COut>(
	GroupingTemplate<TKey> grouping,
	IEnumerable<Aggregation<C, COut>> aggregations
)

Parameters

grouping  GroupingTemplate<TKey>
The grouping template to bind to this data frame.
aggregations  IEnumerable<Aggregation<C, COut>>
The aggregation descriptors to bind and execute.

Type Parameters

TKey
The type of the group keys.
COut
The type of the result dataframe column keys.

Return Value

DataFrame<TKey, COut>
A data frame whose row index is the bound grouping index and whose column keys are descriptor output keys.

Exceptions

ArgumentNullException

grouping is null.

-or-

aggregations is null.

-or-

One of the descriptors in aggregations is null.

InvalidOperationException The template cannot be bound, an aggregation cannot be applied to one of the selected columns, or duplicate output keys are produced.

Aggregate<T1, T2, T3, TResult>(Func<Vector<T1>, TResult>, Func<Vector<T2>, TResult>, Func<Vector<T3>, TResult>)

Applies the specified aggregators to all the columns in the data frame.
C#
public DataFrame<string, C> Aggregate<T1, T2, T3, TResult>(
	Func<Vector<T1>, TResult> aggregator1,
	Func<Vector<T2>, TResult> aggregator2,
	Func<Vector<T3>, TResult> aggregator3
)

Parameters

aggregator1  Func<Vector<T1>, TResult>
A function that aggregates multiple values into one.
aggregator2  Func<Vector<T2>, TResult>
A function that aggregates multiple values into one.
aggregator3  Func<Vector<T3>, TResult>
A function that aggregates multiple values into one.

Type Parameters

T1
The element type of the input to aggregator1
T2
The element type of the input to aggregator2
T3
The element type of the input to aggregator3
TResult
The type of the result of the aggregation.

Return Value

DataFrame<String, C>
A new data frame that contains the result of the aggregations with rows indexed by the names of the aggregators and columns indexed by the data frame's column index.

See Also