From 231a73819521ca63a4cdbdc1534a68910f3c160f Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Tue, 3 Mar 2020 13:17:31 -0800 Subject: [PATCH] CLN: avoid values_from_object in NDFrame --- pandas/core/generic.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index f7eb79a4f1c78..93b79627ee2e4 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -1327,7 +1327,7 @@ def equals(self, other): # Unary Methods def __neg__(self): - values = com.values_from_object(self) + values = self._values if is_bool_dtype(values): arr = operator.inv(values) elif ( @@ -1341,7 +1341,7 @@ def __neg__(self): return self.__array_wrap__(arr) def __pos__(self): - values = com.values_from_object(self) + values = self._values if is_bool_dtype(values) or is_period_arraylike(values): arr = values elif ( @@ -1796,7 +1796,7 @@ def empty(self) -> bool_t: __array_priority__ = 1000 def __array__(self, dtype=None) -> np.ndarray: - return com.values_from_object(self) + return np.asarray(self._values, dtype=dtype) def __array_wrap__(self, result, context=None): result = lib.item_from_zerodim(result) @@ -8521,7 +8521,7 @@ def _where( # try to not change dtype at first (if try_quick) if try_quick: - new_other = com.values_from_object(self) + new_other = np.asarray(self) new_other = new_other.copy() new_other[icond] = other other = new_other