DataFrame<R, C>.Stack Method

Definition

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

Overload List

Stack() Returns a data frame containing all values in the data frame as row-column-value pairs.
Stack<T>(IEnumerable<C>, IEnumerable<C>, C, C) Converts a data frame from wide to long format.

Stack

Returns a data frame containing all values in the data frame as row-column-value pairs.
C#
public DataFrame<long, string> Stack()

Return Value

DataFrame<Int64, String>
A data frame with three columns: one for the row index, one for the column index, and one for the value.

Remarks

Missing values are not recorded.

Stack<T>(IEnumerable<C>, IEnumerable<C>, C, C)

Converts a data frame from wide to long format.
C#
public DataFrame<long, C> Stack<T>(
	IEnumerable<C> idColumns,
	IEnumerable<C> valueColumns,
	C variableKey,
	C valueKey
)

Parameters

idColumns  IEnumerable<C>
A sequence of keys of the identifier columns, which remain unstacked.
valueColumns  IEnumerable<C>
A sequence of keys of the value columns, which are stacked.
variableKey  C
The key of the value column in the long data frame.
valueKey  C
The key of the value column in the long data frame.

Type Parameters

T
The type of the elements of the value columns.

Return Value

DataFrame<Int64, C>
A data frame with a column corresponding to each key in idColumns, a column for the key of the value columns, and a column for the value of the value columns.

Remarks

Missing values are not recorded.

See Also