Skip to content

Commit

Permalink
Added branching logic to ww init in nullable types util (#4369)
Browse files Browse the repository at this point in the history
* added branching logic to ww init in nullable types util
  • Loading branch information
MichaelFu512 authored Dec 15, 2023
1 parent a0bea2f commit 703f258
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/source/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion evalml/utils/nullable_type_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pandas as pd
import woodwork as ww
from woodwork.logical_types import AgeNullable, BooleanNullable, IntegerNullable

DOWNCAST_TYPE_DICT = {
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 703f258

Please sign in to comment.