Skip to content

Commit 088dff8

Browse files
committed
Make a mess
1 parent 764e7b1 commit 088dff8

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

pandas/_libs/testing.pyx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ from pandas._libs.lib import is_complex
1111
from pandas._libs.util cimport is_array, is_real_number_object
1212

1313
from pandas.core.dtypes.common import is_dtype_equal
14+
from pandas.core.dtypes.inference import is_array_like
1415
from pandas.core.dtypes.missing import array_equivalent, isna
1516

1617

pandas/core/dtypes/missing.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,11 @@ def array_equivalent(
424424
# Slow path when we allow comparing different dtypes.
425425
# Object arrays can contain None, NaN and NaT.
426426
# string dtypes must be come to this path for NumPy 1.7.1 compat
427+
try:
428+
return np.array_equal(left, right)
429+
except:
430+
pass
431+
427432
if is_string_dtype(left.dtype) or is_string_dtype(right.dtype):
428433
return _array_equivalent_object(left, right, strict_nan)
429434

pandas/tests/dtypes/test_inference.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ def test_is_array_like():
209209
assert inference.is_array_like(Series([1, 2]))
210210
assert inference.is_array_like(np.array(["a", "b"]))
211211
assert inference.is_array_like(Index(["2016-01-01"]))
212+
assert inference.is_array_like(np.array([2, 3]))
213+
assert inference.is_array_like(MockNumpyLikeArray(np.array([2, 3])))
212214

213215
class DtypeList(list):
214216
dtype = "special"
@@ -221,6 +223,12 @@ class DtypeList(list):
221223
assert not inference.is_array_like(123)
222224

223225

226+
def test_assert_almost_equal():
227+
tm.assert_almost_equal(np.array(2), np.array(2))
228+
eg = MockNumpyLikeArray(np.array(2))
229+
tm.assert_almost_equal(eg, eg)
230+
231+
224232
@pytest.mark.parametrize(
225233
"eg",
226234
(

0 commit comments

Comments
 (0)