Skip to content

REF: Remove series_apply #40108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions pandas/core/apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,22 +98,6 @@ def frame_apply(
)


def series_apply(
obj: Series,
func: AggFuncType,
convert_dtype: bool = True,
args=None,
kwargs=None,
) -> SeriesApply:
return SeriesApply(
obj,
func,
convert_dtype,
args,
kwargs,
)


class Apply(metaclass=abc.ABCMeta):
axis: int

Expand Down
10 changes: 6 additions & 4 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
ops,
)
from pandas.core.accessor import CachedAccessor
from pandas.core.apply import series_apply
from pandas.core.apply import SeriesApply
from pandas.core.arrays import ExtensionArray
from pandas.core.arrays.categorical import CategoricalAccessor
from pandas.core.arrays.sparse import SparseAccessor
Expand Down Expand Up @@ -4003,7 +4003,7 @@ def aggregate(self, func=None, axis=0, *args, **kwargs):
if func is None:
func = dict(kwargs.items())

op = series_apply(self, func, args=args, kwargs=kwargs)
op = SeriesApply(self, func, convert_dtype=False, args=args, kwargs=kwargs)
result = op.agg()
return result

Expand All @@ -4019,7 +4019,9 @@ def transform(
) -> FrameOrSeriesUnion:
# Validate axis argument
self._get_axis_number(axis)
result = series_apply(self, func=func, args=args, kwargs=kwargs).transform()
result = SeriesApply(
self, func=func, convert_dtype=True, args=args, kwargs=kwargs
).transform()
return result

def apply(
Expand Down Expand Up @@ -4131,7 +4133,7 @@ def apply(
Helsinki 2.484907
dtype: float64
"""
return series_apply(self, func, convert_dtype, args, kwargs).apply()
return SeriesApply(self, func, convert_dtype, args, kwargs).apply()

def _reduce(
self,
Expand Down