It seems if you pass a Pandas series to a CPU-jitted function then the typing fails - it is necessary to call to_numpy()
on the Series first. For example, in:
import pandas as pd
from numba import njit
@njit
def add_one(x):
for i in range(len(x)):
x[i] += 1
s = pd.Series([1, 2, 3])
print(s)
add_one(s.to_numpy())
print(s)
add_one(s)
print(s)
the first call to add_one()
succeeds, and the second fails with:
numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
non-precise type pyobject
During: typing of argument at /home/gmarkall/numbadev/issues/pd-series/repro.py (7)
File "repro.py", line 7:
def add_one(x):
for i in range(len(x)):
^
This error may have been caused by the following argument(s):
- argument 0: Cannot determine Numba type of <class 'pandas.core.series.Series'>
Is this expected?