From 703f258d48c0b05e8f7ffb85f69bad0be4028dd9 Mon Sep 17 00:00:00 2001 From: Michael Fu Date: Fri, 15 Dec 2023 13:12:04 -0800 Subject: [PATCH] Added branching logic to ww init in nullable types util (#4369) * added branching logic to ww init in nullable types util --- docs/source/release_notes.rst | 1 + evalml/utils/nullable_type_utils.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) 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,