CopyForeignColumn / Manipulation Layer

Copy a column from second DataFrame and insert it at a specified position in first DataFrame. Similar to pandas' insert() with data from another DataFrame.

Example:

First DataFrame (destination):

idnamescore
1Alice95
2Bob87
3Carol92

Second DataFrame (source):

gradestatusyear
AActive2024
BActive2024
APending2024

Result (copying 'status' at index 2):

idnamestatusscore
1AliceActive95
2BobActive87
3CarolPending92

Key characteristics:

  • Requires equal row counts
  • Preserves row alignment
  • Maintains original data type
  • Supports position-based insertion
  • Original columns shift right

Common applications:

  • Column reorganization
  • Data structure alignment
  • Schema standardization
  • Selective data integration
  • Layout optimization
  • Report formatting
  • View customization
Table
0
Table
1
0
Table

Columns

[, ...]

Select

column

Column to copy from second DataFrame. Common scenarios:

  • Additional attributes
  • Supplementary information
  • Calculated results
  • Reference data
  • Classification labels

Zero-based position where column should be inserted. Examples:

  • 0: Insert at beginning
  • 1: Insert after first column
  • n: Insert after nth column

Existing columns from this position shift right

Name for the new column. If not provided, the system generates a unique name. If AsColumn matches an existing column, the existing column is replaced. The name should follow valid column naming conventions.