Skip to content

Commit

Permalink
REF: Remove series_apply (pandas-dev#40108)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhshadrach authored Feb 27, 2021
1 parent 9bdeee6 commit 4193b0e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
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

0 comments on commit 4193b0e

Please sign in to comment.