Skip to content
This repository has been archived by the owner on Feb 2, 2024. It is now read-only.

Commit

Permalink
Merge 9e189e6 into 5b91644
Browse files Browse the repository at this point in the history
  • Loading branch information
PokhodenkoSA committed Oct 26, 2019
2 parents 5b91644 + 9e189e6 commit 0098967
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
11 changes: 11 additions & 0 deletions numba_pandas/__init__.py
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 added numba_pandas/tests/__init__.py
Empty file.
24 changes: 24 additions & 0 deletions numba_pandas/tests/test_pandas.py
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)
8 changes: 7 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,4 +528,10 @@ def run(self):
install_requires=['numba'],
extras_require={'HDF5': ["h5py"], 'Parquet': ["pyarrow"]},
cmdclass=hpat_build_commands,
ext_modules=_ext_mods)
ext_modules=_ext_mods,
entry_points={
"numba_extensions": [
"init = numba_pandas:_init_extension",
],
},
)

0 comments on commit 0098967

Please sign in to comment.