File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change 129
129
roperator ,
130
130
)
131
131
from pandas .core .accessor import Accessor
132
- from pandas .core .apply import reconstruct_and_relabel_result
132
+ from pandas .core .apply import NumbaExecutionEngine , reconstruct_and_relabel_result
133
133
from pandas .core .array_algos .take import take_2d_multi
134
134
from pandas .core .arraylike import OpsMixin
135
135
from pandas .core .arrays import (
@@ -10616,14 +10616,14 @@ def apply(
10616
10616
significant amount of time to run. Fast functions are unlikely to run faster
10617
10617
with JIT compilation.
10618
10618
"""
10619
- if engine is None or isinstance ( engine , str ) :
10620
- from pandas . core . apply import frame_apply
10621
-
10622
- if engine is None :
10623
- engine = "python"
10619
+ if engine == "numba" :
10620
+ numba = import_optional_dependency ( "numba" )
10621
+ numba_jit = numba . jit ( ** engine_kwargs )
10622
+ numba_jit . __pandas_udf__ = NumbaExecutionEngine
10623
+ engine = numba_jit
10624
10624
10625
- if engine not in [ "python" , "numba" ] :
10626
- raise ValueError ( f"Unknown engine ' { engine } '" )
10625
+ if engine is None or engine == "python" :
10626
+ from pandas . core . apply import frame_apply
10627
10627
10628
10628
op = frame_apply (
10629
10629
self ,
@@ -10632,7 +10632,7 @@ def apply(
10632
10632
raw = raw ,
10633
10633
result_type = result_type ,
10634
10634
by_row = by_row ,
10635
- engine = engine ,
10635
+ engine = "python" ,
10636
10636
engine_kwargs = engine_kwargs ,
10637
10637
args = args ,
10638
10638
kwargs = kwargs ,
You can’t perform that action at this time.
0 commit comments