Skip to content

Commit 4193b0e

Browse files
authored
REF: Remove series_apply (#40108)
1 parent 9bdeee6 commit 4193b0e

File tree

2 files changed

+6
-20
lines changed

2 files changed

+6
-20
lines changed

pandas/core/apply.py

-16
Original file line numberDiff line numberDiff line change
@@ -98,22 +98,6 @@ def frame_apply(
9898
)
9999

100100

101-
def series_apply(
102-
obj: Series,
103-
func: AggFuncType,
104-
convert_dtype: bool = True,
105-
args=None,
106-
kwargs=None,
107-
) -> SeriesApply:
108-
return SeriesApply(
109-
obj,
110-
func,
111-
convert_dtype,
112-
args,
113-
kwargs,
114-
)
115-
116-
117101
class Apply(metaclass=abc.ABCMeta):
118102
axis: int
119103

pandas/core/series.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
ops,
9797
)
9898
from pandas.core.accessor import CachedAccessor
99-
from pandas.core.apply import series_apply
99+
from pandas.core.apply import SeriesApply
100100
from pandas.core.arrays import ExtensionArray
101101
from pandas.core.arrays.categorical import CategoricalAccessor
102102
from pandas.core.arrays.sparse import SparseAccessor
@@ -4003,7 +4003,7 @@ def aggregate(self, func=None, axis=0, *args, **kwargs):
40034003
if func is None:
40044004
func = dict(kwargs.items())
40054005

4006-
op = series_apply(self, func, args=args, kwargs=kwargs)
4006+
op = SeriesApply(self, func, convert_dtype=False, args=args, kwargs=kwargs)
40074007
result = op.agg()
40084008
return result
40094009

@@ -4019,7 +4019,9 @@ def transform(
40194019
) -> FrameOrSeriesUnion:
40204020
# Validate axis argument
40214021
self._get_axis_number(axis)
4022-
result = series_apply(self, func=func, args=args, kwargs=kwargs).transform()
4022+
result = SeriesApply(
4023+
self, func=func, convert_dtype=True, args=args, kwargs=kwargs
4024+
).transform()
40234025
return result
40244026

40254027
def apply(
@@ -4131,7 +4133,7 @@ def apply(
41314133
Helsinki 2.484907
41324134
dtype: float64
41334135
"""
4134-
return series_apply(self, func, convert_dtype, args, kwargs).apply()
4136+
return SeriesApply(self, func, convert_dtype, args, kwargs).apply()
41354137

41364138
def _reduce(
41374139
self,

0 commit comments

Comments
 (0)