Skip to content

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 NameChange of each renamed column, at least one. The renaming keeps its own copy of the list.

Raises:

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