@@ -194,7 +194,9 @@ def map(
194
194
"""
195
195
Elementwise map for the Numba engine. Currently not supported.
196
196
"""
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
+ )
198
200
199
201
@staticmethod
200
202
def apply (
@@ -222,9 +224,8 @@ def apply(
222
224
if data .empty :
223
225
return data .copy () # mimic apply_empty_result()
224
226
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
+ )
228
229
229
230
return NumbaExecutionEngine .apply_raw_false (
230
231
data , func , args , kwargs , decorator , axis
@@ -298,7 +299,9 @@ def apply_raw_false(
298
299
return DataFrame () if isinstance (data , DataFrame ) else Series ()
299
300
300
301
@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 :
302
305
from pandas import Series
303
306
304
307
if engine_kwargs .get ("parallel" , False ):
@@ -344,7 +347,7 @@ def generate_numba_apply_func(
344
347
345
348
jitted_udf = numba .extending .register_jitable (func )
346
349
347
- @decorator # type: ignore
350
+ @decorator
348
351
def numba_func (values , col_names_index , index , * args ):
349
352
results = {}
350
353
for i in range (values .shape [1 - axis ]):
@@ -368,16 +371,12 @@ def numba_func(values, col_names_index, index, *args):
368
371
return numba_func
369
372
370
373
@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 ]:
374
375
func = cast (Callable , func )
375
376
args , kwargs = prepare_function_arguments (
376
377
func , args , kwargs , num_required_args = 1
377
378
)
378
- nb_func = NumbaExecutionEngine .generate_numba_apply_func (
379
- func , axis , decorator
380
- )
379
+ nb_func = NumbaExecutionEngine .generate_numba_apply_func (func , axis , decorator )
381
380
382
381
from pandas .core ._numba .extensions import set_numba_data
383
382
0 commit comments