DataFrame<R, C>.AggregateBy Method

Definition

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

Overload List

AggregateBy<R1>(C, AggregatorGroup[]) Returns a new data frame that aggregates the columns grouped by the specified column.
AggregateBy<R1>(C, ValueTuple<C, AggregatorGroup>[]) Returns a new data frame that aggregates the columns grouped by the specified column.
AggregateBy<R1>(Grouping<R1>, AggregatorGroup[]) Returns a new data frame that aggregates the columns according to the specified grouping.
AggregateBy<R1>(Grouping<R1>, IDictionary<C, AggregatorGroup>) Applies the aggregators from a dictionary to selected columns in the data frame.
AggregateBy<R1>(Grouping<R1>, ValueTuple<C, AggregatorGroup>[]) Returns a new data frame that aggregates the columns according to the specified grouping.
AggregateBy<R1>(IGrouping, AggregatorGroup[]) Returns a new data frame that aggregates the columns according to the specified grouping.
AggregateBy<R1>(IGrouping, ValueTuple<C, AggregatorGroup>[]) Returns a new data frame that aggregates the columns according to the specified grouping.
AggregateBy<R1>(IList<R1>, AggregatorGroup[]) Returns a new data frame that aggregates the columns grouped by the specified vector.
AggregateBy<R1>(IList<R1>, ValueTuple<C, AggregatorGroup>[]) Returns a new data frame that aggregates the columns grouped by the specified vector.
AggregateBy<R1, T>(C, AggregatorGroup<T>) Returns a new data frame that aggregates the columns grouped by the specified column.
AggregateBy<R1, T>(Grouping<R1>, AggregatorGroup<T>) Returns a new data frame that aggregates the columns according to the specified grouping.
AggregateBy<R1, T>(IGrouping, AggregatorGroup<T>) Returns a new data frame that aggregates the columns according to the specified grouping.
AggregateBy<R1, T>(IList<R1>, AggregatorGroup<T>) Returns a new data frame that aggregates the columns grouped by the specified vector.
AggregateBy<R1, C1>(Grouping<R1>, IEnumerable<ValueTuple<C, AggregatorGroup>>, Index<C1>) Applies the specified aggregators to all the columns in the data frame.
AggregateBy<R1, T, U>(C, Func<Vector<T>, U>) Applies the specified aggregation function to the values in each column grouped by the specified grouping column.

AggregateBy<R1>(C, AggregatorGroup[])

Returns a new data frame that aggregates the columns grouped by the specified column.
C#
public DataFrame<R1, (C , string )> AggregateBy<R1>(
	C groupingColumnKey,
	params AggregatorGroup[] aggregators
)

Parameters

groupingColumnKey  C
The key of the grouping column.
aggregators  AggregatorGroup[]
One or more aggregators to apply to each group.

Type Parameters

R1
The element type of the grouping column.

Return Value

DataFrame<R1, ValueTuple<C, String>>
A new data frame with values the result of applying aggregators to each group of the remaining columns. The rows are indexed by the unique elements of the grouping column. The columns are indexed by a multi-level index consisting of the original column key and the name of the aggregator.

AggregateBy<R1>(C, ValueTuple<C, AggregatorGroup>[])

Returns a new data frame that aggregates the columns grouped by the specified column.
C#
public DataFrame<R1, (C , string )> AggregateBy<R1>(
	C groupingColumnKey,
	params (C , AggregatorGroup )[] aggregators
)

Parameters

groupingColumnKey  C
The key of the grouping column.
aggregators  ValueTuple<C, AggregatorGroup>[]
One or more aggregators to apply to each group.

Type Parameters

R1
The element type of the grouping column.

Return Value

DataFrame<R1, ValueTuple<C, String>>
A new data frame with values the result of applying aggregators to each group of the remaining columns. The rows are indexed by the unique elements of the grouping column. The columns are indexed by a multi-level index consisting of the original column key and the name of the aggregator.

AggregateBy<R1, T>(C, AggregatorGroup<T>)

Returns a new data frame that aggregates the columns grouped by the specified column.
C#
public DataFrame<R1, C> AggregateBy<R1, T>(
	C groupingColumnKey,
	AggregatorGroup<T> aggregator
)

Parameters

groupingColumnKey  C
The key of the grouping column.
aggregator  AggregatorGroup<T>
The aggregator to apply to each group.

Type Parameters

R1
The element type of the grouping column.
T
The type of the result of the aggregator.

Return Value

DataFrame<R1, C>
A new data frame, with rows indexed by the unique elements of the column with key groupingColumnKey, and values the result of applying aggregator to each group of the remaining columns.

Exceptions

KeyNotFoundException

The data frame does not contain a column with key groupingColumnKey.

InvalidCastException

The column with key groupingColumnKey can not be cast to type R1.

ArgumentNullException

aggregator is null.

AggregateBy<R1, T, U>(C, Func<Vector<T>, U>)

Applies the specified aggregation function to the values in each column grouped by the specified grouping column.
C#
public DataFrame<R1, C> AggregateBy<R1, T, U>(
	C groupingColumn,
	Func<Vector<T>, U> aggregator
)

Parameters

groupingColumn  C
The key of the grouping column.
aggregator  Func<Vector<T>, U>
A function that transforms a vector of type T to a value of type U.

Type Parameters

R1
The element type of the grouping column.
T
The element type of the columns to group.
U
The type of the result of the aggregation.

Return Value

DataFrame<R1, C>
A new data frame with rows indexed by the unique elements of column groupingColumn and values the result of aggregator applied to each grouping.

Exceptions

ArgumentNullException

aggregator is null.

AggregateBy<R1>(Grouping<R1>, AggregatorGroup[])

Returns a new data frame that aggregates the columns according to the specified grouping.
C#
public DataFrame<R1, (C , string )> AggregateBy<R1>(
	Grouping<R1> grouping,
	params AggregatorGroup[] aggregators
)

Parameters

grouping  Grouping<R1>
A grouping object.
aggregators  AggregatorGroup[]
One or more aggregators to apply to each group.

Type Parameters

R1
The element type of the grouping column.

Return Value

DataFrame<R1, ValueTuple<C, String>>
A new data frame with values the result of applying aggregators to each group of the remaining columns. The rows are indexed by the unique elements of the grouping vector. The columns are indexed by a multi-level index consisting of the original column key and the name of the aggregator.

AggregateBy<R1>(Grouping<R1>, IDictionary<C, AggregatorGroup>)

Applies the aggregators from a dictionary to selected columns in the data frame.
C#
public DataFrame<R1, C> AggregateBy<R1>(
	Grouping<R1> grouping,
	IDictionary<C, AggregatorGroup> aggregators
)

Parameters

grouping  Grouping<R1>
The grouping object.
aggregators  IDictionary<C, AggregatorGroup>
A dictionary that maps column keys to aggregators.

Type Parameters

R1
The type of the group keys.

Return Value

DataFrame<R1, C>
A new data frame with a column for each entry in aggregators which is the result of applying the aggregator in the entry's value to the column with the entry's key. The order of the columns is preserved.

AggregateBy<R1>(Grouping<R1>, ValueTuple<C, AggregatorGroup>[])

Returns a new data frame that aggregates the columns according to the specified grouping.
C#
public DataFrame<R1, (C , string )> AggregateBy<R1>(
	Grouping<R1> grouping,
	params (C , AggregatorGroup )[] aggregators
)

Parameters

grouping  Grouping<R1>
A grouping object.
aggregators  ValueTuple<C, AggregatorGroup>[]
One or more aggregators to apply to each group.

Type Parameters

R1
The element type of the grouping column.

Return Value

DataFrame<R1, ValueTuple<C, String>>
A new data frame with values the result of applying aggregators to each group of the remaining columns. The rows are indexed by the unique elements of the grouping vector. The columns are indexed by a multi-level index consisting of the original column key and the name of the aggregator.

AggregateBy<R1, T>(Grouping<R1>, AggregatorGroup<T>)

Returns a new data frame that aggregates the columns according to the specified grouping.
C#
public DataFrame<R1, C> AggregateBy<R1, T>(
	Grouping<R1> grouping,
	AggregatorGroup<T> aggregator
)

Parameters

grouping  Grouping<R1>
The grouping object.
aggregator  AggregatorGroup<T>
The aggregator to apply to each group.

Type Parameters

R1
The element type of the grouping.
T
The type of the result of the aggregator.

Return Value

DataFrame<R1, C>
A new data frame, with rows indexed by the index associated with grouping, and as values the result of applying aggregator to each group of each column.

Exceptions

ArgumentNullException

grouping is null.

-or-

aggregator is null.

InvalidCastException

The index of grouping cannot be cast to have element type R1.

AggregateBy<R1>(IGrouping, AggregatorGroup[])

Returns a new data frame that aggregates the columns according to the specified grouping.
C#
public DataFrame<R1, (C , string )> AggregateBy<R1>(
	IGrouping grouping,
	params AggregatorGroup[] aggregators
)

Parameters

grouping  IGrouping
A grouping object.
aggregators  AggregatorGroup[]
One or more aggregators to apply to each group.

Type Parameters

R1
The element type of the grouping column.

Return Value

DataFrame<R1, ValueTuple<C, String>>
A new data frame with values the result of applying aggregators to each group of the remaining columns. The rows are indexed by the unique elements of the grouping vector. The columns are indexed by a multi-level index consisting of the original column key and the name of the aggregator.

AggregateBy<R1>(IGrouping, ValueTuple<C, AggregatorGroup>[])

Returns a new data frame that aggregates the columns according to the specified grouping.
C#
public DataFrame<R1, (C , string )> AggregateBy<R1>(
	IGrouping grouping,
	params (C , AggregatorGroup )[] aggregators
)

Parameters

grouping  IGrouping
A grouping object.
aggregators  ValueTuple<C, AggregatorGroup>[]
One or more aggregators to apply to each group.

Type Parameters

R1
The element type of the grouping column.

Return Value

DataFrame<R1, ValueTuple<C, String>>
A new data frame with values the result of applying aggregators to each group of the remaining columns. The rows are indexed by the unique elements of the grouping vector. The columns are indexed by a multi-level index consisting of the original column key and the name of the aggregator.

AggregateBy<R1, T>(IGrouping, AggregatorGroup<T>)

Returns a new data frame that aggregates the columns according to the specified grouping.
C#
public DataFrame<R1, C> AggregateBy<R1, T>(
	IGrouping grouping,
	AggregatorGroup<T> aggregator
)

Parameters

grouping  IGrouping
The grouping object.
aggregator  AggregatorGroup<T>
The aggregator to apply to each group.

Type Parameters

R1
The element type of the grouping.
T
The type of the result of the aggregator.

Return Value

DataFrame<R1, C>
A new data frame, with rows indexed by the index associated with grouping, and as values the result of applying aggregator to each group of each column.

Exceptions

ArgumentNullException

grouping is null.

-or-

aggregator is null.

InvalidCastException

The index of grouping cannot be cast to have element type R1.

AggregateBy<R1>(IList<R1>, AggregatorGroup[])

Returns a new data frame that aggregates the columns grouped by the specified vector.
C#
public DataFrame<R1, (C , string )> AggregateBy<R1>(
	IList<R1> groupingVector,
	params AggregatorGroup[] aggregators
)

Parameters

groupingVector  IList<R1>
A list that specifies group membership.
aggregators  AggregatorGroup[]
One or more aggregators to apply to each group.

Type Parameters

R1
The element type of the grouping column.

Return Value

DataFrame<R1, ValueTuple<C, String>>
A new data frame with values the result of applying aggregators to each group of the remaining columns. The rows are indexed by the unique elements of the grouping vector. The columns are indexed by a multi-level index consisting of the original column key and the name of the aggregator.

AggregateBy<R1>(IList<R1>, ValueTuple<C, AggregatorGroup>[])

Returns a new data frame that aggregates the columns grouped by the specified vector.
C#
public DataFrame<R1, (C , string )> AggregateBy<R1>(
	IList<R1> groupingVector,
	params (C , AggregatorGroup )[] aggregators
)

Parameters

groupingVector  IList<R1>
A list that specifies group membership.
aggregators  ValueTuple<C, AggregatorGroup>[]
One or more aggregators to apply to each group.

Type Parameters

R1
The element type of the grouping column.

Return Value

DataFrame<R1, ValueTuple<C, String>>
A new data frame with values the result of applying aggregators to each group of the remaining columns. The rows are indexed by the unique elements of the grouping vector. The columns are indexed by a multi-level index consisting of the original column key and the name of the aggregator.

AggregateBy<R1, T>(IList<R1>, AggregatorGroup<T>)

Returns a new data frame that aggregates the columns grouped by the specified vector.
C#
public DataFrame<R1, C> AggregateBy<R1, T>(
	IList<R1> groupingVector,
	AggregatorGroup<T> aggregator
)

Parameters

groupingVector  IList<R1>
The vector that contains the group memberships.
aggregator  AggregatorGroup<T>
The aggregator to apply to each group.

Type Parameters

R1
The element type of the grouping vector.
T
The type of the result of the aggregator.

Return Value

DataFrame<R1, C>
A new data frame, with rows indexed by the unique elements of groupingVector, and as values the result of applying aggregator to each group of each column.

Exceptions

ArgumentNullException

groupingVector is null.

-or-

aggregator is null.

AggregateBy<R1, C1>(Grouping<R1>, IEnumerable<ValueTuple<C, AggregatorGroup>>, Index<C1>)

Applies the specified aggregators to all the columns in the data frame.
C#
public DataFrame<R1, C1> AggregateBy<R1, C1>(
	Grouping<R1> grouping,
	IEnumerable<(C , AggregatorGroup )> aggregators,
	Index<C1> newIndex
)

Parameters

grouping  Grouping<R1>
The grouping object.
aggregators  IEnumerable<ValueTuple<C, AggregatorGroup>>
One or more aggregators to use.
newIndex  Index<C1>
The new column index.

Type Parameters

R1
The type of the group keys.
C1
The type of the new column keys.

Return Value

DataFrame<R1, C1>
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