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
force
bool
return
Frame
See also¶
rbind()
– function for row-binding several frames.dt.Frame.cbind()
– Frame method for cbinding some frames to another.
Examples¶
from datatable import dt, f
DT = dt.Frame(A=[1, 2, 3], B=[4, 7, 0])
DT
A | B | ||
---|---|---|---|
int32 | int32 | ||
0 | 1 | 4 | |
1 | 2 | 7 | |
2 | 3 | 0 |
frame1 = dt.Frame(N=[-1, -2, -5])
frame1
N | ||
---|---|---|
int32 | ||
0 | -1 | |
1 | -2 | |
2 | -5 |
dt.cbind([DT, frame1])
A | B | N | ||
---|---|---|---|---|
int32 | int32 | int32 | ||
0 | 1 | 4 | -1 | |
1 | 2 | 7 | -2 | |
2 | 3 | 0 | -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)
A | B | N | ||
---|---|---|---|---|
int32 | int32 | int32 | ||
0 | 1 | 4 | -1 | |
1 | 2 | 7 | -2 | |
2 | 3 | 0 | -5 | |
3 | NA | NA | -20 |
The content on this page is licensed under the Creative Commons Attribution 4.0 License
(CC BY 4.0) ,
and code samples are licensed under the MIT License.