Renaming(changes)
Source¶
The new names of columns of a Table, applied at once, used by Table.rename.
Two columns can swap their names in a single renaming.
Added in version 0.1.0
Parameters:
-
changes(list[NameChange])The
NameChangeof each renamed column, at least one. The renaming keeps its own copy of the list.
Raises:
-
InvalidTypeErrorWhen a setting is not of the type its annotation names.
-
EmptyListErrorWhen
changesis an empty list. -
DuplicateColumnErrorWhen a column is renamed twice, or two columns receive the same new name.
Examples:
import numdaplot as ndp
low = ndp.Array.from_list([1.0, 2.0])
high = ndp.Array.from_list([9.0, 8.0])
bounds = ndp.Table.from_arrays({"low": low, "high": high})
swap = [ndp.NameChange(old_name="low", new_name="high"), ndp.NameChange(old_name="high", new_name="low")]
bounds.rename(ndp.Renaming(changes=swap))
# high low
# FLOAT64 FLOAT64
# 0 1.0 9.0
# 1 2.0 8.0