Join(other, keys, mode=JoinMode.INNER, suffixes=None, key_types=KeyTypes.SAME_FAMILY, relation=Relation.MANY_TO_MANY)
Source¶
Settings of a join of two Tables on the values of key columns, used by Table.join.
Each row of the joined Table meets each row of the other Table having the same keys. A missing key never matches, as in SQL. The rows of the joined Table come first, in their order, then the unmatched rows of the other Table. The columns are the keys, then the other columns of the joined Table, then those of the other Table.
Added in version 0.1.0
Parameters:
-
other(Table)The Table joined to this one.
-
keys(list[str]) -
mode(JoinMode, default:JoinMode.INNER) -
suffixes(JoinSuffixes | None, default:None)The suffixes of the columns both Tables have besides the keys. When omitted, such a column raises
DuplicateColumnError. -
key_types(KeyTypes, default:KeyTypes.SAME_FAMILY)How close the types of each key must be,
KeyTypes.SAME_FAMILYby default:INT64matchesFLOAT64. -
relation(Relation, default:Relation.MANY_TO_MANY)How many times each key may appear in this Table, the left one, and in the other Table, the right one,
Relation.MANY_TO_MANYby default, which checks nothing.
Raises:
-
InvalidTypeErrorWhen a setting is not of the type its annotation names.
-
EmptyListErrorWhen
keysis an empty list. -
InvalidColumnNameErrorWhen a name in
keysis an empty text. -
DuplicateColumnErrorWhen a name appears twice in
keys.
Examples:
import numdaplot as ndp
accidents = ndp.Table.from_arrays({"id": ndp.Array.from_list([1, 2]), "dep": ndp.Array.from_list(["75", "69"])})
users = ndp.Table.from_arrays({"id": ndp.Array.from_list([1, 1]), "age": ndp.Array.from_list([34, 8])})
accidents.join(ndp.Join(other=users, keys=["id"]))
# id dep age
# INT64 TEXT INT64
# 0 1 75 34
# 1 1 75 8