Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions pandas/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
is_list_like,
is_object_dtype,
is_scalar,
needs_i8_conversion,
)
from pandas.core.dtypes.generic import ABCDataFrame, ABCIndexClass, ABCSeries
from pandas.core.dtypes.missing import isna
Expand Down Expand Up @@ -656,13 +655,6 @@ def item(self):
ValueError
If the data is not length-1.
"""
if not (
is_extension_array_dtype(self.dtype) or needs_i8_conversion(self.dtype)
):
# numpy returns ints instead of datetime64/timedelta64 objects,
# which we need to wrap in Timestamp/Timedelta/Period regardless.
return self._values.item()

if len(self) == 1:
return next(iter(self))
raise ValueError("can only convert an array of size 1 to a Python scalar")
Expand Down