MCPcopy
hub / github.com/pandas-dev/pandas / __neg__

Method __neg__

pandas/core/generic.py:1457–1472  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1455
1456 @final
1457 def __neg__(self) -> Self:
1458 def blk_func(values: ArrayLike):
1459 if is_bool_dtype(values.dtype):
1460 # error: Argument 1 to "inv" has incompatible type "Union
1461 # [ExtensionArray, ndarray[Any, Any]]"; expected
1462 # "_SupportsInversion[ndarray[Any, dtype[bool_]]]"
1463 return operator.inv(values) # type: ignore[arg-type]
1464 else:
1465 # error: Argument 1 to "neg" has incompatible type "Union
1466 # [ExtensionArray, ndarray[Any, Any]]"; expected
1467 # "_SupportsNeg[ndarray[Any, dtype[Any]]]"
1468 return operator.neg(values) # type: ignore[arg-type]
1469
1470 new_data = self._mgr.apply(blk_func)
1471 res = self._constructor_from_mgr(new_data, axes=new_data.axes)
1472 return res.__finalize__(self, method="__neg__")
1473
1474 @final
1475 def __pos__(self) -> Self:

Callers

nothing calls this directly

Calls 3

__finalize__Method · 0.80
applyMethod · 0.45
_constructor_from_mgrMethod · 0.45

Tested by

no test coverage detected