Skip to content

Commit 703f258

Browse files
authored
Added branching logic to ww init in nullable types util (#4369)
* added branching logic to ww init in nullable types util
1 parent a0bea2f commit 703f258

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

docs/source/release_notes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Release Notes
33
**Future Releases**
44
* Enhancements
55
* Fixes
6+
* Fixed bug in `_downcast_nullable_y` causing woodwork initialization issues :pr:`4369`
67
* Changes
78
* Documentation Changes
89
* Testing Changes

evalml/utils/nullable_type_utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pandas as pd
2+
import woodwork as ww
23
from woodwork.logical_types import AgeNullable, BooleanNullable, IntegerNullable
34

45
DOWNCAST_TYPE_DICT = {
@@ -57,7 +58,10 @@ def _downcast_nullable_y(y, handle_boolean_nullable=True, handle_integer_nullabl
5758
y with any incompatible nullable types downcasted to compatible equivalents.
5859
"""
5960
if y.ww.schema is None:
60-
y.ww.init()
61+
if isinstance(y, pd.DataFrame):
62+
y.ww.init()
63+
else:
64+
y = ww.init_series(y)
6165

6266
incompatible_logical_types = _get_incompatible_nullable_types(
6367
handle_boolean_nullable,

0 commit comments

Comments
 (0)