DataFrame<R, C>.AddColumn Method

Definition

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

Overload List

AddColumn(C, IVector) Adds a column to the data frame.
AddColumn<T>(C, Vector<T>) Adds a column to the data frame.
AddColumn<T>(C, IList<T>) Adds a column to the data frame.

AddColumn(C, IVector)

Adds a column to the data frame.
C#
public DataFrame<R, C> AddColumn(
	C key,
	IVector values
)

Parameters

key  C
The key of the column.
values  IVector
The data for the column.

Return Value

DataFrame<R, C>

Remarks

If values has a row index with the same element type as the data frame, a left join between the data frame's index and that index is used to determine the order of the elements of values in the new column.

If values has no index, or if the index has a different element type, all elements are added in the order provided. If the data frame has more rows than are present in values, missing values are appended. If the data frame has fewer rows, values is truncated.

Exceptions

InvalidOperationException

The data frame already contains a column with the specified key.

AddColumn<T>(C, Vector<T>)

Adds a column to the data frame.
C#
public DataFrame<R, C> AddColumn<T>(
	C key,
	Vector<T> values
)

Parameters

key  C
The key of the column.
values  Vector<T>
The data for the column.

Type Parameters

T

Return Value

DataFrame<R, C>

Remarks

If values has a row index with the same element type as the data frame, a left join between the data frame's index and that index is used to determine the order of the elements of values in the new column.

If values has no index, or if the index has a different element type, all elements are added in the order provided. If the data frame has more rows than are present in values, missing values are appended. If the data frame has fewer rows, values is truncated.

AddColumn<T>(C, IList<T>)

Adds a column to the data frame.
C#
public DataFrame<R, C> AddColumn<T>(
	C key,
	IList<T> values
)

Parameters

key  C
The key of the column.
values  IList<T>
A list containing the data for the column.

Type Parameters

T

Return Value

DataFrame<R, C>

Remarks

If values has a row index with the same element type as the data frame, a left join between the data frame's index and that index is used to determine the order of the elements of values in the new column.

If values has no index, or if the index has a different element type, all elements are added in the order provided. If the data frame has more rows than are present in values, missing values are appended. If the data frame has fewer rows, values is truncated.

See Also