DataFrame.Resample Method

Definition

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

Overload List

Resample<C>(DataFrame<DateTime, C>, Recurrence, IDictionary<C, AggregatorGroup>, Direction) Resamples the rows of the data frame according to the specified recurrence.
Resample<C>(DataFrame<DateTime, C>, Recurrence, IList<AggregatorGroup>, Direction) Resamples the rows of the data frame according to the specified recurrence.
Resample<C, C1>(DataFrame<DateTime, C>, Recurrence, IEnumerable<ValueTuple<C, AggregatorGroup>>, Index<C1>, Direction) Resamples the rows of the data frame according to the specified recurrence.

Resample<C>(DataFrame<DateTime, C>, Recurrence, IDictionary<C, AggregatorGroup>, Direction)

Resamples the rows of the data frame according to the specified recurrence.
C#
public static DataFrame<DateTime, C> Resample<C>(
	this DataFrame<DateTime, C> frame,
	Recurrence recurrence,
	IDictionary<C, AggregatorGroup> aggregators,
	Direction direction = Direction.Backward
)

Parameters

frame  DataFrame<DateTime, C>
A data frame.
recurrence  Recurrence
The recurrence pattern to resample to.
aggregators  IDictionary<C, AggregatorGroup>
A dictionary that maps column keys to aggregators.
direction  Direction  (Optional)
Indicates whether the entries in frame's row index should be taken as the start (Forward) or end (Backward) of a sampling interval.

Type Parameters

C

Return Value

DataFrame<DateTime, C>
A new data frame with a column for each entry in aggregators which is the result of resampling the column with the entry's key using the specified recurrence pattern and the aggregator in the entry's value. The order of the columns is preserved.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type DataFrame<DateTime, C>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Exceptions

ArgumentNullException

frame is null.

-or-

recurrence is null.

-or-

aggregators is null.

Resample<C>(DataFrame<DateTime, C>, Recurrence, IList<AggregatorGroup>, Direction)

Resamples the rows of the data frame according to the specified recurrence.
C#
public static DataFrame<DateTime, C> Resample<C>(
	this DataFrame<DateTime, C> frame,
	Recurrence recurrence,
	IList<AggregatorGroup> aggregators,
	Direction direction = Direction.Backward
)

Parameters

frame  DataFrame<DateTime, C>
A data frame.
recurrence  Recurrence
The recurrence pattern to resample to.
aggregators  IList<AggregatorGroup>
A list of aggregators.
direction  Direction  (Optional)
Indicates whether the entries in frame's row index should be taken as the start (Forward) or end (Backward) of a sampling interval.

Type Parameters

C

Return Value

DataFrame<DateTime, C>
A new data frame which is the result of resampling each column with the corresponding aggregator in aggregators.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type DataFrame<DateTime, C>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Exceptions

ArgumentNullException

frame is null.

-or-

recurrence is null.

-or-

aggregators is null.

DimensionMismatchException

The length of aggregators does not equal the number of columns in frame.

Resample<C, C1>(DataFrame<DateTime, C>, Recurrence, IEnumerable<ValueTuple<C, AggregatorGroup>>, Index<C1>, Direction)

Resamples the rows of the data frame according to the specified recurrence.
C#
public static DataFrame<DateTime, C1> Resample<C, C1>(
	this DataFrame<DateTime, C> frame,
	Recurrence recurrence,
	IEnumerable<(C , AggregatorGroup )> aggregators,
	Index<C1> newIndex,
	Direction direction = Direction.Backward
)

Parameters

frame  DataFrame<DateTime, C>
A data frame.
recurrence  Recurrence
The recurrence pattern to resample to.
aggregators  IEnumerable<ValueTuple<C, AggregatorGroup>>
A sequence of tuples of column keys and aggregators.
newIndex  Index<C1>
The column index of the new data frame.
direction  Direction  (Optional)
Indicates whether the entries in frame's row index should be taken as the start (Forward) or end (Backward) of a sampling interval.

Type Parameters

C
C1

Return Value

DataFrame<DateTime, C1>
A new data frame with a column for each key-aggregator tuple in aggregators which is the result of resampling the column with the key using the specified recurrence pattern and the aggregator.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type DataFrame<DateTime, C>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Exceptions

ArgumentNullException

frame is null.

-or-

recurrence is null.

-or-

aggregators is null.

See Also