datatable.rbind()

Produce a new frame by appending rows of several frames.

This function is equivalent to:

dt.Frame().rbind(*frames, force=force, by_names=by_names)

Parameters

frames
Frame | List[Frame] | None
force
bool
bynames
bool
return
Frame

Examples

from datatable import dt DT1 = dt.Frame({"Weight": [5, 4, 6], "Height": [170, 172, 180]}) DT1
WeightHeight
int32int32
05170
14172
26180
DT2 = dt.Frame({"Height": [180, 181, 169], "Weight": [4, 4, 5]}) DT2
WeightHeight
int32int32
04180
14181
25169
dt.rbind(DT1, DT2)
WeightHeight
int32int32
05170
14172
26180
34180
44181
55169

rbind() by default combines frames by names. The frames can also be bound by column position by setting the bynames parameter to False:

dt.rbind(DT1, DT2, bynames = False)
WeightHeight
int32int32
05170
14172
26180
31804
41814
51695

If the number of columns are not equal or the column names are different, you can force the row binding by setting the force parameter to True:

DT2["Age"] = dt.Frame([25, 50, 67]) DT2
WeightHeightAge
int32int32int32
0418025
1418150
2516967
dt.rbind(DT1, DT2, force = True)
WeightHeightAge
int32int32int32
05170NA
14172NA
26180NA
3418025
4418150
5516967

See also

  • cbind() – function for col-binding several frames.

  • dt.Frame.rbind() – Frame method for rbinding some frames to another.