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
The name of all columns contained in the roles object.
Names of all unused columns (unused_float + unused_string).