The Python Oracle

numba - TypingError: cannot determine Numba type of <class 'builtin_function_or_method'>

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Realization

--

Chapters
00:00 Numba - Typingerror: Cannot Determine Numba Type Of ≪Class 'Builtin_function_or_method'&G
01:02 Accepted Answer Score 32
01:24 Answer 2 Score 6
02:07 Thank you

--

Full question
https://stackoverflow.com/questions/5074...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #jit #numba

#avk47



ACCEPTED ANSWER

Score 32


Pandas and several other function calls in your code will not work with nopython=True. The available libraries that can be used with numba jit in nopython is fairly limited (pretty much only to numpy arrays and certain python builtin libraries). You can find more information here




ANSWER 2

Score 6


Per the deprecation recommendations, it's very reasonable that code which doesn't compile with @jit(nopython=True) could be faster without the decorator.

Anecdotally, I found the trivial example I landed here researching was notably faster when simply passing the Pandas columns directly to my function to vectorize the operation, rather than using numba and paying the method overhead of the columns for a numpy array.

However, it continues with the expected argument to clear this warning

If there is benefit to having the @jit decorator present, then to be future proof supply the keyword argument forceobj=True to ensure the function is always compiled in object mode.