Skip to content

Commit c239fc9

Browse files
make mypy happy
1 parent 58fb30d commit c239fc9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pandas/core/frame.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10481,10 +10481,11 @@ def apply(
1048110481
f"{result_type=} only implemented for the default engine"
1048210482
)
1048310483

10484-
agg_axis = self._get_agg_axis(axis)
10484+
agg_axis = self._get_agg_axis(self._get_axis_number(axis))
1048510485

1048610486
# one axis is empty
1048710487
if not all(self.shape):
10488+
func = cast(Callable, func)
1048810489
try:
1048910490
if axis == 0:
1049010491
r = func(Series([], dtype=np.float64), *args, **kwargs)
@@ -10506,13 +10507,13 @@ def apply(
1050610507
return self._constructor_sliced(r, index=agg_axis)
1050710508
return self.copy()
1050810509

10509-
data = self
10510+
data: DataFrame | np.ndarray = self
1051010511
if raw:
1051110512
# This will upcast the whole DataFrame to the same type,
1051210513
# and likely result in an object 2D array.
1051310514
# We should probably pass a list of 1D arrays instead, at
1051410515
# lest for ``axis=0``
10515-
data = data.values
10516+
data = self.values
1051610517
result = engine.__pandas_udf__.apply(
1051710518
data=data,
1051810519
func=func,

0 commit comments

Comments
 (0)