Roles¶
-
class
getml.data.
Roles
(categorical: List[str] = <factory>, join_key: List[str] = <factory>, numerical: List[str] = <factory>, target: List[str] = <factory>, text: List[str] = <factory>, time_stamp: List[str] = <factory>, unused_float: List[str] = <factory>, unused_string: 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).