DataFrame<R, C>.AddColumn Method

Definition

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

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, elements are added in the order provided and their count must equal the existing row count. A first column in a completely empty data frame establishes its row count.

The new column has no explicit dataframe-owned metadata. Use SetColumnRole(C, ColumnRole) or SetColumnSemantics(C, ColumnSemanticInfo) to assign metadata after adding the column.

Exceptions

InvalidOperationException

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

ArgumentNullExceptionvalues is null.
DimensionMismatchExceptionPositional input has a different length from the existing row axis.

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, elements are added in the order provided and their count must equal the existing row count. A first column in a completely empty data frame establishes its row count.

The new column has no explicit dataframe-owned metadata. Use SetColumnRole(C, ColumnRole) or SetColumnSemantics(C, ColumnSemanticInfo) to assign metadata after adding the column.

Exceptions

ArgumentNullExceptionvalues is null.
DimensionMismatchExceptionPositional input has a different length from the existing row axis.

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, elements are added in the order provided and their count must equal the existing row count. A first column in a completely empty data frame establishes its row count.

The new column has no explicit dataframe-owned metadata. Use SetColumnRole(C, ColumnRole) or SetColumnSemantics(C, ColumnSemanticInfo) to assign metadata after adding the column.

Exceptions

ArgumentNullExceptionvalues is null.
DimensionMismatchExceptionPositional input has a different length from the existing row axis.

See Also