NameChange(old_name, new_name)
Source¶
A new name for one column of a Table, used by Renaming.
Added in version 0.1.0
Parameters:
-
old_name(str)The current name of the column.
-
new_name(str)Its new name, a non-empty text.
Raises:
-
InvalidTypeErrorWhen a setting is not of the type its annotation names.
-
InvalidColumnNameErrorWhen
old_nameornew_nameis an empty text.
Examples:
import numdaplot as ndp
cities = ndp.Array.from_list(["Paris", "Lyon", "Paris"])
prices = ndp.Array.from_list([120.0, 80.0, 150.0])
sales = ndp.Table.from_arrays({"city": cities, "price": prices})
sales.rename(ndp.Renaming(changes=[ndp.NameChange(old_name="city", new_name="town")]))
# town price
# TEXT FLOAT64
# 0 Paris 120.0
# 1 Lyon 80.0
# 2 Paris 150.0