DataFrame<R, C>.WithRowIndex Method

Definition

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

Overload List

WithRowIndex<R1>(C) Returns a new data frame using the specified column as the index.
WithRowIndex<R1>(Index<R1>) Returns a new data frame that uses the specified row index.
WithRowIndex<R1, R2>(C, C) Returns a new data frame using the specified columns as a hierarchical index.
WithRowIndex<R1, R2, R3>(C, C, C) Returns a new data frame using the specified columns as a hierarchical index.

WithRowIndex<R1>(C)

Returns a new data frame using the specified column as the index.
C#
public DataFrame<R1, C> WithRowIndex<R1>(
	C columnKey
)

Parameters

columnKey  C
The key of the column.

Type Parameters

R1
The element type of the column.

Return Value

DataFrame<R1, C>
A new data frame that contains all the columns in the current data frame indexed by columnKey.

Exceptions

InvalidCastException

The column with key columnKey could not be cast to a vector with element type R1.

KeyNotFoundException

A column with key columnKey could not be found.

WithRowIndex<R1>(Index<R1>)

Returns a new data frame that uses the specified row index.
C#
public DataFrame<R1, C> WithRowIndex<R1>(
	Index<R1> newRowIndex
)

Parameters

newRowIndex  Index<R1>
The new row index.

Type Parameters

R1
The element type of the new row index.

Return Value

DataFrame<R1, C>

Remarks

The length of the new index must be the same as the number of rows in the data frame. Otherwise a DimensionMismatchException is thrown.

Exceptions

DimensionMismatchException

The length of newRowIndex is not equal to the number of rows in the data frame.

WithRowIndex<R1, R2>(C, C)

Returns a new data frame using the specified columns as a hierarchical index.
C#
public DataFrame<(R1 , R2 ), C> WithRowIndex<R1, R2>(
	C column1Key,
	C column2Key
)

Parameters

column1Key  C
The key of the first column.
column2Key  C
The key of the second column.

Type Parameters

R1
The element type of the first column.
R2
The element type of the second column.

Return Value

DataFrame<ValueTuple<R1, R2>, C>
A new data frame that contains all the columns in the current data frame indexed by column1Key and column2Key.

Exceptions

KeyNotFoundException

A column with key column1Key could not be found.

-or-

A column with key column2Key could not be found.

InvalidCastException

The column with key column1Key could not be cast to a vector with element type R1.

-or-

The column with key column2Key could not be cast to a vector with element type R2.

WithRowIndex<R1, R2, R3>(C, C, C)

Returns a new data frame using the specified columns as a hierarchical index.
C#
public DataFrame<(R1 , R2 , R3 ), C> WithRowIndex<R1, R2, R3>(
	C column1Key,
	C column2Key,
	C column3Key
)

Parameters

column1Key  C
The key of the first column.
column2Key  C
The key of the second column.
column3Key  C
The key of the second column.

Type Parameters

R1
The element type of the first column.
R2
The element type of the second column.
R3
The element type of the second column.

Return Value

DataFrame<ValueTuple<R1, R2, R3>, C>
A new data frame that contains all the columns in the current data frame indexed by column1Key, column2Key, and column3Key.

Exceptions

KeyNotFoundException

A column with key column1Key could not be found.

-or-

A column with key column2Key could not be found.

-or-

A column with key column3Key could not be found.

InvalidCastException

The column with key column1Key could not be cast to a vector with element type R1.

-or-

The column with key column2Key could not be cast to a vector with element type R2.

-or-

The column with key column3Key could not be cast to a vector with element type R3.

See Also