Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLN: Remove deprecated numba functions #53455

Merged
merged 1 commit into from
May 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pandas/core/groupby/numba_.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def generate_numba_agg_func(
-------
Numba function
"""
numba_func = jit_user_function(func, nopython, nogil, parallel)
numba_func = jit_user_function(func)
if TYPE_CHECKING:
import numba
else:
Expand Down Expand Up @@ -152,7 +152,7 @@ def generate_numba_transform_func(
-------
Numba function
"""
numba_func = jit_user_function(func, nopython, nogil, parallel)
numba_func = jit_user_function(func)
if TYPE_CHECKING:
import numba
else:
Expand Down
33 changes: 5 additions & 28 deletions pandas/core/util/numba_.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
"""Common utilities for Numba operations"""
from __future__ import annotations

import types
from typing import (
TYPE_CHECKING,
Callable,
)

import numpy as np

from pandas.compat._optional import import_optional_dependency
from pandas.errors import NumbaUtilError

Expand Down Expand Up @@ -63,27 +60,20 @@ def get_jit_arguments(
return {"nopython": nopython, "nogil": nogil, "parallel": parallel}


def jit_user_function(
func: Callable, nopython: bool, nogil: bool, parallel: bool
) -> Callable:
def jit_user_function(func: Callable) -> Callable:
"""
JIT the user's function given the configurable arguments.
If user function is not jitted already, mark the user's function
as jitable.

Parameters
----------
func : function
user defined function
nopython : bool
nopython parameter for numba.JIT
nogil : bool
nogil parameter for numba.JIT
parallel : bool
parallel parameter for numba.JIT

Returns
-------
function
Numba JITed function
Numba JITed function, or function marked as JITable by numba
"""
if TYPE_CHECKING:
import numba
Expand All @@ -94,19 +84,6 @@ def jit_user_function(
# Don't jit a user passed jitted function
numba_func = func
else:

@numba.generated_jit(nopython=nopython, nogil=nogil, parallel=parallel)
def numba_func(data, *_args):
if getattr(np, func.__name__, False) is func or isinstance(
func, types.BuiltinFunctionType
):
jf = func
else:
jf = numba.jit(func, nopython=nopython, nogil=nogil)

def impl(data, *_args):
return jf(data, *_args)

return impl
numba_func = numba.extending.register_jitable(func)

return numba_func
4 changes: 2 additions & 2 deletions pandas/core/window/numba_.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def generate_numba_apply_func(
-------
Numba function
"""
numba_func = jit_user_function(func, nopython, nogil, parallel)
numba_func = jit_user_function(func)
if TYPE_CHECKING:
import numba
else:
Expand Down Expand Up @@ -207,7 +207,7 @@ def generate_numba_table_func(
-------
Numba function
"""
numba_func = jit_user_function(func, nopython, nogil, parallel)
numba_func = jit_user_function(func)
if TYPE_CHECKING:
import numba
else:
Expand Down