DataFrame<R, C>.RenameColumn Method

Definition

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

Overload List

RenameColumn(C, C) Renames the specified column.
RenameColumn(IEnumerable<C>, IEnumerable<C>) Renames the specified column.

RenameColumn(C, C)

Renames the specified column.
C#
public DataFrame<R, C> RenameColumn(
	C oldKey,
	C newKey
)

Parameters

oldKey  C
The current key of the column.
newKey  C
The new key of the column.

Return Value

DataFrame<R, C>
The current data frame with the specified key in the column index replaced.

Remarks

Renaming a column preserves dataframe-owned metadata for the renamed column. The metadata follows the column to newKey.

Exceptions

KeyNotFoundException

The key oldKey was not found in the column index.

InvalidOperationException

The key newKey already exists in the column index.

RenameColumn(IEnumerable<C>, IEnumerable<C>)

Renames the specified column.
C#
public DataFrame<R, C> RenameColumn(
	IEnumerable<C> oldKeys,
	IEnumerable<C> newKeys
)

Parameters

oldKeys  IEnumerable<C>
A sequence of the current column keys.
newKeys  IEnumerable<C>
A sequence of the corresponding new column keys.

Return Value

DataFrame<R, C>
The current data frame with the specified keys in the column index replaced.

Remarks

Renaming columns preserves dataframe-owned metadata for the renamed columns. Metadata follows the affected column positions to their corresponding new keys.

Exceptions

KeyNotFoundException

One or more of the keys in oldKeys were not found in the column index.

InvalidOperationException

One or more of the keys in newKeys already exists in the column index and is not replaced.

See Also