Skip to content

Commit 66fb100

Browse files
CLN: remove redundant code in IndexOpsMixin.item (#35008)
1 parent 8de43a1 commit 66fb100

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

pandas/core/base.py

-8
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
is_list_like,
2323
is_object_dtype,
2424
is_scalar,
25-
needs_i8_conversion,
2625
)
2726
from pandas.core.dtypes.generic import ABCDataFrame, ABCIndexClass, ABCSeries
2827
from pandas.core.dtypes.missing import isna
@@ -656,13 +655,6 @@ def item(self):
656655
ValueError
657656
If the data is not length-1.
658657
"""
659-
if not (
660-
is_extension_array_dtype(self.dtype) or needs_i8_conversion(self.dtype)
661-
):
662-
# numpy returns ints instead of datetime64/timedelta64 objects,
663-
# which we need to wrap in Timestamp/Timedelta/Period regardless.
664-
return self._values.item()
665-
666658
if len(self) == 1:
667659
return next(iter(self))
668660
raise ValueError("can only convert an array of size 1 to a Python scalar")

0 commit comments

Comments
 (0)