with_role(cols, role, time_formats=None)[source]¶
Returns a new
Viewwith modified roles.
The difference between
with_role()returns a view that is lazily evaluated when needed whereas
set_role()is an in-place operation. From a memory perspective, in-place operations like
When switching from a role based on type float to a role based on type string or vice verse, an implicit type conversion will be conducted. The
time_formatsargument is used to interpret time format string. For more information on roles, please refer to the user guide.
- cols (str, FloatColumn, StingColumn, or List[str, FloatColumn, StringColumn]):
The columns or the names thereof.
- role (str):
The role to be assigned.
- time_formats (str or List[str], optional):
Formats to be used to parse the time stamps. This is only necessary, if an implicit conversion from a StringColumn to a time stamp is taking place.