This repository has been archived by the owner on Feb 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
def _init_extension(): | ||
'''Register Pandas classes and functions with Numba. | ||
This exntry_point is called by Numba when it initializes. | ||
''' | ||
# TODO: import all packages overloading Pandas data types and functions | ||
import hpat.hiframes.api | ||
import hpat.hiframes.boxing | ||
# imported from above packages | ||
# import hpat.hiframes.pd_series_ext |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import numba | ||
import pandas | ||
|
||
from packaging import version | ||
|
||
# numba <0.46 requires explicit import extension | ||
if version.parse(numba.__version__) < version.parse('0.46'): | ||
from numba_pandas import _init_extension | ||
_init_extension() | ||
|
||
|
||
def test_function(): | ||
pandas_func = pandas.Series | ||
|
||
@numba.njit | ||
def numba_func(*args): | ||
return pandas_func(*args) | ||
|
||
args = [0, 1] | ||
|
||
overload_value = numba_func(args) | ||
pandas_value = pandas_func(args) | ||
|
||
pandas.testing.assert_series_equal(overload_value, pandas_value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters