We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8de43a1 commit 66fb100Copy full SHA for 66fb100
pandas/core/base.py
@@ -22,7 +22,6 @@
22
is_list_like,
23
is_object_dtype,
24
is_scalar,
25
- needs_i8_conversion,
26
)
27
from pandas.core.dtypes.generic import ABCDataFrame, ABCIndexClass, ABCSeries
28
from pandas.core.dtypes.missing import isna
@@ -656,13 +655,6 @@ def item(self):
656
655
ValueError
657
If the data is not length-1.
658
"""
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
-
666
if len(self) == 1:
667
return next(iter(self))
668
raise ValueError("can only convert an array of size 1 to a Python scalar")
0 commit comments