DataFrame.insertColumn

DataFrame insertColumn(size_t index, Series col) @safe pure

Adds or replaces one column at a position. An existing name is replaced at its own position - the index applies to new names only. A new name is inserted at index, where 0 ..= width() is valid (width() appends, like withColumn).

Parameters

indexthe insertion position for a new name
colthe column to add or replace

Returns

the new frame.

Throws

DataFrameException on a height mismatch or an index

beyond width() for a new name.