Skip to content

Commit 5d54164

Browse files
committed
revert
1 parent 1ee6952 commit 5d54164

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

pandas/_libs/lib.pyx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def is_iterator(obj: object) -> bool:
221221
return PyIter_Check(obj)
222222

223223

224-
cpdef object item_from_zerodim(object val):
224+
def item_from_zerodim(val: object) -> object:
225225
"""
226226
If the value is a zerodim array, return the item it contains.
227227

@@ -589,7 +589,7 @@ def array_equivalent_object(left: object[:], right: object[:]) -> bool:
589589
except TypeError as err:
590590
# Avoid raising TypeError on tzawareness mismatch
591591
# 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
593593
if "tz-naive and tz-aware" in str(err):
594594
return False
595595
raise
@@ -2344,8 +2344,9 @@ def map_infer_mask(ndarray arr, object f, const uint8_t[:] mask, bint convert=Tr
23442344
else:
23452345
val = f(arr[i])
23462346

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()
23492350

23502351
result[i] = val
23512352

@@ -2383,8 +2384,9 @@ def map_infer(ndarray arr, object f, bint convert=True):
23832384
for i in range(n):
23842385
val = f(arr[i])
23852386

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()
23882390

23892391
result[i] = val
23902392

0 commit comments

Comments
 (0)