DataFrame<R, C>.GetColumns Method

Definition

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

Overload List

GetColumns(ColumnSelector) Returns a new data frame that contains columns selected by a column selector.
GetColumns(C[]) Returns a new data frame that contains only the specified columns.
GetColumns(IEnumerable<C>) Returns a new data frame that contains only the specified columns.

GetColumns(ColumnSelector)

Returns a new data frame that contains columns selected by a column selector.
C#
public DataFrame<R, C> GetColumns(
	ColumnSelector selector
)

Parameters

selector  ColumnSelector
The selector that identifies columns to include.

Return Value

DataFrame<R, C>
A new data frame containing the selected columns.

Remarks

The selector is resolved against a current schema snapshot and inspects schema metadata only; vector values are not read during selector resolution. Selected columns are distinct and returned in schema order. If selector resolves to no columns, the returned data frame has the same row index and no columns.

Dataframe-owned metadata for retained columns is preserved in the returned data frame when available. The returned data frame owns independent metadata sidecars, so later metadata changes on either data frame do not update the other.

Exceptions

ArgumentNullExceptionselector is null.
KeyNotFoundExceptionselector contains an explicit key that is not present in the current schema.
InvalidCastExceptionselector contains typed keys or a typed key predicate whose key type does not match the data frame column-key type.

GetColumns(C[])

Returns a new data frame that contains only the specified columns.
C#
public DataFrame<R, C> GetColumns(
	params C[] keys
)

Parameters

keys  C[]
A list of keys of the columns to return in the new data frame.

Return Value

DataFrame<R, C>
A new data frame.

Remarks

The returned data frame contains the requested columns in the order supplied by keys. Dataframe-owned metadata for retained columns is copied to independent metadata sidecars in the result.

GetColumns(IEnumerable<C>)

Returns a new data frame that contains only the specified columns.
C#
public DataFrame<R, C> GetColumns(
	IEnumerable<C> keys
)

Parameters

keys  IEnumerable<C>
The keys of the columns to return.

Return Value

DataFrame<R, C>
A new data frame.

Remarks

The returned data frame contains the requested columns in the order supplied by keys. Dataframe-owned metadata for retained columns is copied to independent metadata sidecars in the result.

See Also