@@ -221,7 +221,7 @@ def is_iterator(obj: object) -> bool:
221
221
return PyIter_Check(obj )
222
222
223
223
224
- cpdef object item_from_zerodim(object val ) :
224
+ def item_from_zerodim(val: object ) -> object :
225
225
"""
226
226
If the value is a zerodim array , return the item it contains.
227
227
@@ -589,7 +589,7 @@ def array_equivalent_object(left: object[:], right: object[:]) -> bool:
589
589
except TypeError as err:
590
590
# Avoid raising TypeError on tzawareness mismatch
591
591
# TODO: This try/except can be removed if/when Timestamp
592
- # comparisons are change dto match datetime, see GH#28507
592
+ # comparisons are changed to match datetime, see GH#28507
593
593
if " tz-naive and tz-aware" in str (err):
594
594
return False
595
595
raise
@@ -2344,8 +2344,9 @@ def map_infer_mask(ndarray arr, object f, const uint8_t[:] mask, bint convert=Tr
2344
2344
else :
2345
2345
val = f(arr[i])
2346
2346
2347
- # unbox 0-dim arrays, GH#690
2348
- val = item_from_zerodim(val)
2347
+ if cnp.PyArray_IsZeroDim(val):
2348
+ # unbox 0-dim arrays, GH#690
2349
+ val = val.item()
2349
2350
2350
2351
result[i] = val
2351
2352
@@ -2383,8 +2384,9 @@ def map_infer(ndarray arr, object f, bint convert=True):
2383
2384
for i in range (n):
2384
2385
val = f(arr[i])
2385
2386
2386
- # unbox 0-dim arrays, GH#690
2387
- val = item_from_zerodim(val)
2387
+ if cnp.PyArray_IsZeroDim(val):
2388
+ # unbox 0-dim arrays, GH#690
2389
+ val = val.item()
2388
2390
2389
2391
result[i] = val
2390
2392
0 commit comments