DataFrame.with_unit(cols, unit, comparison_only=False)[source]

Returns a view that contains a new unit on one or more columns.

The difference between with_unit() and set_unit() is that with_unit() returns a view that is lazily evaluated when needed whereas set_unit() is an in-place operation. From a memory perspective, in-place operations like set_unit() are preferable.

cols (str, FloatColumn, StingColumn, or List[str, FloatColumn, StringColumn]):

The columns or the names thereof.

unit (str):

The unit to be assigned.

comparison_only (bool):

Whether you want the column to be used for comparison only. This means that the column can only be used in comparison to other columns of the same unit.

An example might be a bank account number: The number in itself is hardly interesting, but it might be useful to know how often we have seen that same bank account number in another table.

If True, this will also set the compare subrole. The feature learning algorithms and the feature selectors will interpret this accordingly.