Skip to content

Commit cf3e392

Browse files
committed
Fix CI and pre-commit
1 parent 176753b commit cf3e392

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

pandas/core/_numba/executor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def generate_apply_looper(func, decorator: Callable):
2525
numba = import_optional_dependency("numba")
2626
nb_compat_func = jit_user_function(func)
2727

28-
@decorator # type: ignore
28+
@decorator
2929
def nb_looper(values, axis, *args):
3030
# Operate on the first row/col in order to get
3131
# the output shape

pandas/core/apply.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ def map(
194194
"""
195195
Elementwise map for the Numba engine. Currently not supported.
196196
"""
197-
raise NotImplementedError("The Numba engine is not implemented for the map method yet.")
197+
raise NotImplementedError(
198+
"The Numba engine is not implemented for the map method yet."
199+
)
198200

199201
@staticmethod
200202
def apply(
@@ -222,9 +224,8 @@ def apply(
222224
if data.empty:
223225
return data.copy() # mimic apply_empty_result()
224226
NumbaExecutionEngine.validate_values_for_numba_raw_false(
225-
data,
226-
decorator if isinstance(decorator, dict) else {}
227-
)
227+
data, decorator if isinstance(decorator, dict) else {}
228+
)
228229

229230
return NumbaExecutionEngine.apply_raw_false(
230231
data, func, args, kwargs, decorator, axis
@@ -298,7 +299,9 @@ def apply_raw_false(
298299
return DataFrame() if isinstance(data, DataFrame) else Series()
299300

300301
@staticmethod
301-
def validate_values_for_numba_raw_false(data: Series | DataFrame, engine_kwargs: dict[str, bool]) -> None:
302+
def validate_values_for_numba_raw_false(
303+
data: Series | DataFrame, engine_kwargs: dict[str, bool]
304+
) -> None:
302305
from pandas import Series
303306

304307
if engine_kwargs.get("parallel", False):
@@ -344,7 +347,7 @@ def generate_numba_apply_func(
344347

345348
jitted_udf = numba.extending.register_jitable(func)
346349

347-
@decorator # type: ignore
350+
@decorator
348351
def numba_func(values, col_names_index, index, *args):
349352
results = {}
350353
for i in range(values.shape[1 - axis]):
@@ -368,16 +371,12 @@ def numba_func(values, col_names_index, index, *args):
368371
return numba_func
369372

370373
@staticmethod
371-
def apply_with_numba(
372-
data, func, args, kwargs, decorator, axis=0
373-
) -> dict[int, Any]:
374+
def apply_with_numba(data, func, args, kwargs, decorator, axis=0) -> dict[int, Any]:
374375
func = cast(Callable, func)
375376
args, kwargs = prepare_function_arguments(
376377
func, args, kwargs, num_required_args=1
377378
)
378-
nb_func = NumbaExecutionEngine.generate_numba_apply_func(
379-
func, axis, decorator
380-
)
379+
nb_func = NumbaExecutionEngine.generate_numba_apply_func(func, axis, decorator)
381380

382381
from pandas.core._numba.extensions import set_numba_data
383382

pandas/core/frame.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10621,10 +10621,11 @@ def apply(
1062110621
"""
1062210622
if engine == "numba":
1062310623
numba = import_optional_dependency("numba")
10624-
engine = numba.jit(**engine_kwargs or {})
10625-
engine.__pandas_udf__ = NumbaExecutionEngine
10624+
numba_jit = numba.jit(**engine_kwargs or {})
10625+
numba_jit.__pandas_udf__ = NumbaExecutionEngine
10626+
engine = numba_jit
1062610627

10627-
if engine is None or isinstance(engine, str):
10628+
elif engine is None or isinstance(engine, str):
1062810629
from pandas.core.apply import frame_apply
1062910630

1063010631
if engine not in ["python", None]:

0 commit comments

Comments
 (0)