Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a7a416f

Browse filesBrowse files
authored
FIX Fixes memory regression for inspecting extension arrays (#26106)
1 parent 10eaa52 commit a7a416f
Copy full SHA for a7a416f

File tree

2 files changed

+3
-7
lines changed
Filter options

2 files changed

+3
-7
lines changed

‎doc/whats_new/v1.3.rst

Copy file name to clipboardExpand all lines: doc/whats_new/v1.3.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ Changelog
452452
:user:`Jérémie du Boisberranger <jeremiedbb>`.
453453

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

457457
- |Fix| :func:`utils.validation.check_array` now suports pandas DataFrames with
458458
extension arrays and object dtypes by return an ndarray with object dtype.

‎sklearn/utils/validation.py

Copy file name to clipboardExpand all lines: sklearn/utils/validation.py
+2-6Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -628,12 +628,8 @@ def _pandas_dtype_needs_early_conversion(pd_dtype):
628628

629629

630630
def _is_extension_array_dtype(array):
631-
try:
632-
from pandas.api.types import is_extension_array_dtype
633-
634-
return is_extension_array_dtype(array)
635-
except ImportError:
636-
return False
631+
# Pandas extension arrays have a dtype with an na_value
632+
return hasattr(array, "dtype") and hasattr(array.dtype, "na_value")
637633

638634

639635
def check_array(

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.