Data Frame<R, C>.Set Column Role Method
Definition
Namespace: Numerics.NET.DataAnalysis
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.8.0
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.8.0
Overload List
| Set | Assigns a role to all columns selected by a column selector. |
| Set | Assigns a role to the specified column. |
SetColumnRole(ColumnSelector, ColumnRole)
Assigns a role to all columns selected by a column selector.
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
| Argument | selector is null. |
| Key | The selector contains an explicit key that is not present in the current schema. |
| Invalid | The selector contains typed keys or a typed key predicate whose key type does not match the data frame column-key type. |
| Argument | role is not a defined ColumnRole value. |
SetColumnRole(C, ColumnRole)
Assigns a role to the specified column.
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
| Argument | key is null. |
| Key | key is not present in the current column index. |
| Argument | role is not a defined ColumnRole value. |