8000 FIX Fixes memory regression for inspecting extension arrays by thomasjpfan · Pull Request #26106 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/whats_new/v1.3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ Changelog
:user:`Jérémie du Boisberranger <jeremiedbb>`.

- |FIX| Fixes :func:`utils.validation.check_array` to properly convert pandas
extension arrays. :pr:`25813` by `Thomas Fan`_.
extension arrays. :pr:`25813` and :pr:`26106` by `Thomas Fan`_.

- |Fix| :func:`utils.validation.check_array` now suports pandas DataFrames with
extension arrays and object dtypes by return an ndarray with object dtype.
Expand Down
8 changes: 2 additions & 6 deletions sklearn/utils/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,12 +628,8 @@ def _pandas_dtype_needs_early_conversion(pd_dtype):


def _is_extension_array_dtype(array):
try:
from pandas.api.types import is_extension_array_dtype

return is_extension_array_dtype(array)
except ImportError:
return False
# Pandas extension arrays have a dtype with an na_value
return hasattr(array, "dtype") and hasattr(array.dtype, "na_value")


def check_array(
Expand Down
0