diff --git a/docs/source/release_notes.rst b/docs/source/release_notes.rst index c4c8bb519b..ed57e0877a 100644 --- a/docs/source/release_notes.rst +++ b/docs/source/release_notes.rst @@ -3,6 +3,7 @@ Release Notes **Future Releases** * Enhancements * Fixes + * Fixed bug in `_downcast_nullable_y` causing woodwork initialization issues :pr:`4369` * Changes * Documentation Changes * Testing Changes diff --git a/evalml/utils/nullable_type_utils.py b/evalml/utils/nullable_type_utils.py index afe84e1a93..4f9d64691f 100644 --- a/evalml/utils/nullable_type_utils.py +++ b/evalml/utils/nullable_type_utils.py @@ -1,4 +1,5 @@ import pandas as pd +import woodwork as ww from woodwork.logical_types import AgeNullable, BooleanNullable, IntegerNullable DOWNCAST_TYPE_DICT = { @@ -57,7 +58,10 @@ def _downcast_nullable_y(y, handle_boolean_nullable=True, handle_integer_nullabl y with any incompatible nullable types downcasted to compatible equivalents. """ if y.ww.schema is None: - y.ww.init() + if isinstance(y, pd.DataFrame): + y.ww.init() + else: + y = ww.init_series(y) incompatible_logical_types = _get_incompatible_nullable_types( handle_boolean_nullable,