The Python Oracle

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

This video explains
numba - TypingError: cannot determine Numba type of

--

Become part of the top 3% of the developers by applying to Toptal
https://topt.al/25cXVn

--

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

--

Chapters
00:00 Question
01:23 Accepted answer (Score 23)
01:53 Answer 2 (Score 3)
02:50 Thank you

--

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

Accepted answer links:
[here]: https://numba.pydata.org/numba-doc/dev/r...

Answer 2 links:
[deprecation recommendations]: https://numba.pydata.org/numba-doc/dev/r...
[vectorize the operation]: https://stackoverflow.com/a/45545111/454...

--

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.