DataFrame<R, C>.SetColumnRole Method

Definition

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

Overload List

SetColumnRole(ColumnSelector, ColumnRole) Assigns a role to all columns selected by a column selector.
SetColumnRole(C, ColumnRole) Assigns a role to the specified column.

SetColumnRole(ColumnSelector, ColumnRole)

Assigns a role to all columns selected by a column selector.
C#
public DataFrame<R, C> SetColumnRole(
	ColumnSelector selector,
	ColumnRole role
)

Parameters

selector  ColumnSelector
The selector that identifies columns to update.
role  ColumnRole
The role to assign.

Return Value

DataFrame<R, C>
The current data frame.

Remarks

The selector is resolved against a current schema snapshot. The resolved columns are distinct and ordered by schema order. Empty selector results are no-ops.

This method mutates dataframe-owned role metadata. Passing None clears any explicit role for the resolved columns.

Exceptions

ArgumentNullExceptionselector is null.
KeyNotFoundException The selector contains an explicit key that is not present in the current schema.
InvalidCastException The selector contains typed keys or a typed key predicate whose key type does not match the data frame column-key type.
ArgumentOutOfRangeExceptionrole is not a defined ColumnRole value.

SetColumnRole(C, ColumnRole)

Assigns a role to the specified column.
C#
public DataFrame<R, C> SetColumnRole(
	C key,
	ColumnRole role
)

Parameters

key  C
The typed column key.
role  ColumnRole
The role to assign.

Return Value

DataFrame<R, C>
The current data frame.

Remarks

This method mutates dataframe-owned role metadata and returns the same data frame. Passing None clears any explicit role for the column.

Later calls to GetSchema() reflect the new role. Previously returned schema snapshots are unchanged.

Exceptions

ArgumentNullExceptionkey is null.
KeyNotFoundExceptionkey is not present in the current column index.
ArgumentOutOfRangeExceptionrole is not a defined ColumnRole value.

See Also