Skip to content

Commit 67aae80

Browse files
authored
CLN: avoid values_from_object in NDFrame (#32422)
1 parent 0d04683 commit 67aae80

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pandas/core/generic.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1327,7 +1327,7 @@ def equals(self, other):
13271327
# Unary Methods
13281328

13291329
def __neg__(self):
1330-
values = com.values_from_object(self)
1330+
values = self._values
13311331
if is_bool_dtype(values):
13321332
arr = operator.inv(values)
13331333
elif (
@@ -1341,7 +1341,7 @@ def __neg__(self):
13411341
return self.__array_wrap__(arr)
13421342

13431343
def __pos__(self):
1344-
values = com.values_from_object(self)
1344+
values = self._values
13451345
if is_bool_dtype(values) or is_period_arraylike(values):
13461346
arr = values
13471347
elif (
@@ -1796,7 +1796,7 @@ def empty(self) -> bool_t:
17961796
__array_priority__ = 1000
17971797

17981798
def __array__(self, dtype=None) -> np.ndarray:
1799-
return com.values_from_object(self)
1799+
return np.asarray(self._values, dtype=dtype)
18001800

18011801
def __array_wrap__(self, result, context=None):
18021802
result = lib.item_from_zerodim(result)
@@ -8521,7 +8521,7 @@ def _where(
85218521

85228522
# try to not change dtype at first (if try_quick)
85238523
if try_quick:
8524-
new_other = com.values_from_object(self)
8524+
new_other = np.asarray(self)
85258525
new_other = new_other.copy()
85268526
new_other[icond] = other
85278527
other = new_other

0 commit comments

Comments
 (0)