Skip to content

Commit 8b420cc

Browse files
CI
1 parent bc2a178 commit 8b420cc

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

pandas/core/bodo_patched.py

+20-9
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,27 @@
22
This file is here as an example, this code will live in the Numba and
33
Bodo libraries.
44
"""
5+
56
from __future__ import annotations
6-
from collections.abc import Callable
7-
from typing import TYPE_CHECKING, Literal, Any
87

9-
import pandas as pd
8+
from typing import (
9+
TYPE_CHECKING,
10+
Any,
11+
Literal,
12+
)
13+
1014
import bodo
1115

16+
import pandas as pd
17+
1218
if TYPE_CHECKING:
13-
from pandas._typing import Axis, AggFuncType
19+
from collections.abc import Callable
20+
21+
from pandas._typing import (
22+
AggFuncType,
23+
Axis,
24+
)
25+
1426

1527
def __pandas_udf__(
1628
jit_decorator: Callable,
@@ -24,17 +36,14 @@ def __pandas_udf__(
2436
kwargs: dict[str, Any],
2537
by_row: Literal[False, "compat"],
2638
):
27-
2839
if isinstance(obj, pd.DataFrame) and method == "apply":
2940
if result_type is not None:
3041
raise NotImplementedError(
3142
"engine='bodo' not supported when result_type is not None"
3243
)
3344

3445
if raw:
35-
raise NotImplementedError(
36-
"engine='bodo' not supported when raw=True"
37-
)
46+
raise NotImplementedError("engine='bodo' not supported when raw=True")
3847
if isinstance(func, str) and axis != 1:
3948
raise NotImplementedError(
4049
"engine='bodo' only supports axis=1 when func is the name of a "
@@ -44,14 +53,16 @@ def __pandas_udf__(
4453
raise NotImplementedError(
4554
"engine='bodo' not supported when args or kwargs are specified"
4655
)
56+
4757
@jit_decorator
4858
def jit_func(df, func, axis):
4959
return df.apply(func, axis=axis)
5060

5161
return jit_func(obj, func, axis)
5262
else:
5363
raise NotImplementedError(
54-
f"engine='bodo' not supported for {obj.__class__.__name__}.{method}"
64+
f"engine='bodo' not supported for {obj.__name__}.{method}"
5565
)
5666

67+
5768
bodo.jit.__pandas_udf__ = __pandas_udf__

pandas/core/frame.py

+1
Original file line numberDiff line numberDiff line change
@@ -10383,6 +10383,7 @@ def apply(
1038310383
<https://numba.readthedocs.io/en/stable/index.html>`_
1038410384
.. [2] `Bodo documentation
1038510385
<https://docs.bodo.ai/latest/>`/
10386+
1038610387
Examples
1038710388
--------
1038810389
>>> df = pd.DataFrame([[4, 9]] * 3, columns=["A", "B"])

0 commit comments

Comments
 (0)