woodwork_utils#
Woodwork utility methods.
Module Contents#
Functions#
Downcasts IntegerNullable, BooleanNullable types to Double, Boolean in order to support certain estimators like ARIMA, CatBoost, and LightGBM. |
|
Create a Woodwork structure from the given list, pandas, or numpy input, with specified types for columns. If a column's type is not specified, it will be inferred by Woodwork. |
Attributes Summary#
Contents#
- evalml.utils.woodwork_utils.downcast_nullable_types(data, ignore_null_cols=True)[source]#
Downcasts IntegerNullable, BooleanNullable types to Double, Boolean in order to support certain estimators like ARIMA, CatBoost, and LightGBM.
- Parameters
data (pd.DataFrame, pd.Series) – Feature data.
ignore_null_cols (bool) – Whether to ignore downcasting columns with null values or not. Defaults to True.
- Returns
DataFrame or Series initialized with logical type information where BooleanNullable are cast as Double.
- Return type
data
- evalml.utils.woodwork_utils.infer_feature_types(data, feature_types=None)[source]#
Create a Woodwork structure from the given list, pandas, or numpy input, with specified types for columns. If a column’s type is not specified, it will be inferred by Woodwork.
- Parameters
data (pd.DataFrame, pd.Series) – Input data to convert to a Woodwork data structure.
feature_types (string, ww.logical_type obj, dict, optional) – If data is a 2D structure, feature_types must be a dictionary mapping column names to the type of data represented in the column. If data is a 1D structure, then feature_types must be a Woodwork logical type or a string representing a Woodwork logical type (“Double”, “Integer”, “Boolean”, “Categorical”, “Datetime”, “NaturalLanguage”)
- Returns
A Woodwork data structure where the data type of each column was either specified or inferred.
- Raises
ValueError – If there is a mismatch between the dataframe and the woodwork schema.
- evalml.utils.woodwork_utils.numeric_and_boolean_ww#