Roles

class getml.data.Roles(categorical: ~typing.List[str] = <factory>, join_key: ~typing.List[str] = <factory>, numerical: ~typing.List[str] = <factory>, target: ~typing.List[str] = <factory>, text: ~typing.List[str] = <factory>, time_stamp: ~typing.List[str] = <factory>, unused_float: ~typing.List[str] = <factory>, unused_string: ~typing.List[str] = <factory>)[source]

Roles can be passed to DataFrame to predefine the roles assigned to certain columns.

Example:
>>> roles = getml.data.Roles(
>>>     ...         categorical=["col1", "col2"], target=["col3"])
>>>
>>> df_expd = data.DataFrame.from_csv(
        ...         fnames=["file1.csv", "file2.csv"],
        ...         name="MY DATA FRAME",
        ...         sep=';',
        ...         quotechar='"',
        ...         roles=roles
        ... )

Methods

infer(colname)

Infers the role of a column.

to_dict()

Expresses the roles object as a dictionary.

to_list()

Returns a list containing the roles, without the corresponding columns names.

Attributes

columns

The name of all columns contained in the roles object.

unused

Names of all unused columns (unused_float + unused_string).

categorical

join_key

numerical

target

text

time_stamp

unused_float

unused_string