Skip to content

Commit f107695

Browse files
lithomas1topper-123
authored andcommitted
CLN: Remove deprecated numba functions (pandas-dev#53455)
CLN/DEPR: Remove deprecated numba functions
1 parent 32c9ea9 commit f107695

File tree

3 files changed

+9
-32
lines changed

3 files changed

+9
-32
lines changed

pandas/core/groupby/numba_.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def generate_numba_agg_func(
9292
-------
9393
Numba function
9494
"""
95-
numba_func = jit_user_function(func, nopython, nogil, parallel)
95+
numba_func = jit_user_function(func)
9696
if TYPE_CHECKING:
9797
import numba
9898
else:
@@ -152,7 +152,7 @@ def generate_numba_transform_func(
152152
-------
153153
Numba function
154154
"""
155-
numba_func = jit_user_function(func, nopython, nogil, parallel)
155+
numba_func = jit_user_function(func)
156156
if TYPE_CHECKING:
157157
import numba
158158
else:

pandas/core/util/numba_.py

+5-28
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
"""Common utilities for Numba operations"""
22
from __future__ import annotations
33

4-
import types
54
from typing import (
65
TYPE_CHECKING,
76
Callable,
87
)
98

10-
import numpy as np
11-
129
from pandas.compat._optional import import_optional_dependency
1310
from pandas.errors import NumbaUtilError
1411

@@ -63,27 +60,20 @@ def get_jit_arguments(
6360
return {"nopython": nopython, "nogil": nogil, "parallel": parallel}
6461

6562

66-
def jit_user_function(
67-
func: Callable, nopython: bool, nogil: bool, parallel: bool
68-
) -> Callable:
63+
def jit_user_function(func: Callable) -> Callable:
6964
"""
70-
JIT the user's function given the configurable arguments.
65+
If user function is not jitted already, mark the user's function
66+
as jitable.
7167
7268
Parameters
7369
----------
7470
func : function
7571
user defined function
76-
nopython : bool
77-
nopython parameter for numba.JIT
78-
nogil : bool
79-
nogil parameter for numba.JIT
80-
parallel : bool
81-
parallel parameter for numba.JIT
8272
8373
Returns
8474
-------
8575
function
86-
Numba JITed function
76+
Numba JITed function, or function marked as JITable by numba
8777
"""
8878
if TYPE_CHECKING:
8979
import numba
@@ -94,19 +84,6 @@ def jit_user_function(
9484
# Don't jit a user passed jitted function
9585
numba_func = func
9686
else:
97-
98-
@numba.generated_jit(nopython=nopython, nogil=nogil, parallel=parallel)
99-
def numba_func(data, *_args):
100-
if getattr(np, func.__name__, False) is func or isinstance(
101-
func, types.BuiltinFunctionType
102-
):
103-
jf = func
104-
else:
105-
jf = numba.jit(func, nopython=nopython, nogil=nogil)
106-
107-
def impl(data, *_args):
108-
return jf(data, *_args)
109-
110-
return impl
87+
numba_func = numba.extending.register_jitable(func)
11188

11289
return numba_func

pandas/core/window/numba_.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def generate_numba_apply_func(
4848
-------
4949
Numba function
5050
"""
51-
numba_func = jit_user_function(func, nopython, nogil, parallel)
51+
numba_func = jit_user_function(func)
5252
if TYPE_CHECKING:
5353
import numba
5454
else:
@@ -207,7 +207,7 @@ def generate_numba_table_func(
207207
-------
208208
Numba function
209209
"""
210-
numba_func = jit_user_function(func, nopython, nogil, parallel)
210+
numba_func = jit_user_function(func)
211211
if TYPE_CHECKING:
212212
import numba
213213
else:

0 commit comments

Comments
 (0)