ENH: should we support np.allclose for ExtensionArrays? #37915
Labels
Compat
pandas objects compatability with Numpy or Python functions
Enhancement
ExtensionArray
Extending pandas with custom dtypes or arrays.
Needs Discussion
Requires discussion from core team before further action
ufuncs
__array_ufunc__ and __array_function__
xref https://github.com/pandas-dev/pandas/pull/33435/files#r406534850
I'm looking into picking up #33435. Currently the issue is that
np.allclose
throws when called on an EA:The error message is about the
isfinite
ufunc not being implemented. The root cause here is thatnp.isclose
callsnp.asanyarray
on its inputs and the following triggers the same error:The issue is that when
np.asanyarray
is called on EA input it returns anobject
dtype:As far as #33435 is concerned, one solution is to cast to a NumPy array before calling
np.allclose
. Would we, however, want to makenp.allclose
work directly on the integer/floating EAs?The text was updated successfully, but these errors were encountered: