with_unit¶
- 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()
andset_unit()
is thatwith_unit()
returns a view that is lazily evaluated when needed whereasset_unit()
is an in-place operation. From a memory perspective, in-place operations likeset_unit()
are preferable.- Args:
- 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.