with_role

DataFrame.with_role(cols, role, time_formats=None)[source]

Returns a new View with modified roles.

The difference between with_role() and set_role() is that 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 set_role() are preferable.

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_formats argument is used to interpret time format string. For more information on roles, please refer to the user guide.

Args:
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.