JoinSuffixes(left, right)
Source¶
Suffixes added to the names of the columns both Tables of a join have, besides the keys, used by Join.
Only those columns get a suffix, as in pandas. A suffixed name that another column already has raises
DuplicateColumnError at the join.
Added in version 0.1.0
Parameters:
-
left(str)The suffix of the columns of the joined Table, such as
"_2024". -
right(str)The suffix of the columns of the other Table, such as
"_2025".
Raises:
-
InvalidTypeErrorWhen a setting is not of the type its annotation names.
-
InvalidSuffixesErrorWhen a suffix is empty, or both suffixes are the same.
Examples:
import numdaplot as ndp
before = ndp.Table.from_arrays({"dep": ndp.Array.from_list(["75"]), "deaths": ndp.Array.from_list([40])})
after = ndp.Table.from_arrays({"dep": ndp.Array.from_list(["75"]), "deaths": ndp.Array.from_list([35])})
years = ndp.JoinSuffixes(left="_2024", right="_2025")
before.join(ndp.Join(other=after, keys=["dep"], suffixes=years))
# dep deaths_2024 deaths_2025
# TEXT INT64 INT64
# 0 75 40 35