(self)
| 1558 | return result |
| 1559 | |
| 1560 | def apply_standard(self) -> DataFrame | Series: |
| 1561 | # caller is responsible for ensuring that f is Callable |
| 1562 | func = cast(Callable, self.func) |
| 1563 | obj = self.obj |
| 1564 | |
| 1565 | if isinstance(func, np.ufunc): |
| 1566 | with np.errstate(all="ignore"): |
| 1567 | return func(obj, *self.args, **self.kwargs) |
| 1568 | elif not self.by_row: |
| 1569 | return func(obj, *self.args, **self.kwargs) |
| 1570 | |
| 1571 | if self.args or self.kwargs: |
| 1572 | # _map_values does not support args/kwargs |
| 1573 | def curried(x): |
| 1574 | return func(x, *self.args, **self.kwargs) |
| 1575 | |
| 1576 | else: |
| 1577 | curried = func |
| 1578 | mapped = obj._map_values(mapper=curried) |
| 1579 | |
| 1580 | if len(mapped) and isinstance(mapped[0], ABCSeries): |
| 1581 | # GH#43986 Need to do list(mapped) in order to get treated as nested |
| 1582 | # See also GH#25959 regarding EA support |
| 1583 | return obj._constructor_expanddim(list(mapped), index=obj.index) |
| 1584 | else: |
| 1585 | return obj._constructor(mapped, index=obj.index).__finalize__( |
| 1586 | obj, method="apply" |
| 1587 | ) |
| 1588 | |
| 1589 | |
| 1590 | class GroupByApply(Apply): |
no test coverage detected