datatable.cbind()

Create a new Frame by appending columns from several frames.

This function is exactly equivalent to:

dt.Frame().cbind(*frames, force=force)

Parameters

frames
Frame | List[Frame] | None

The list/tuple/sequence/generator expression of Frames to append. It may also contain None values, which will be simply skipped.

force
bool

If True, allows Frames to be appended even if they have unequal number of rows. The resulting Frame will have number of rows equal to the largest among all Frames. Those Frames which have less than the largest number of rows, will be padded with NAs (with the exception of Frames having just 1 row, which will be replicated instead of filling with NAs).

return
Frame

A new frame that is created by appending columns from frames.

See also

  • rbind() – function for row-binding several frames.

  • dt.Frame.cbind() – Frame method for cbinding several frames to another.

Examples

from datatable import dt, f DT = dt.Frame(A=[1, 2, 3], B=[4, 7, 0]) DT
AB
int32int32
014
127
230
frame1 = dt.Frame(N=[-1, -2, -5]) frame1
N
int32
0-1
1-2
2-5
dt.cbind([DT, frame1])
ABN
int32int32int32
014-1
127-2
230-5

If the number of rows are not equal, you can force the binding by setting the force parameter to True:

frame2 = dt.Frame(N=[-1, -2, -5, -20]) frame2
N
int32
0-1
1-2
2-5
3-20
dt.cbind([DT, frame2], force=True)
ABN
int32int32int32
014-1
127-2
230-5
3NANA-20