You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Generally, vectorized Numpy operations are mostly superior to Numba's by a small margin. The reason why some functions such as nanmax_nb were written in Numba is that they can be used inside of user's njited code. Current version of Numba doesn't support axis argument in functions such as nanmax so you will find nanmax_nb quite handy. Also this particular function can be further optimized (it just does np.nanmax on each column) but it's used nowhere in vectorbt (pd.DataFrame.vbt.max uses NumPy and optionally bottleneck) so you can just ignore its existence. Finally, vectorbt's true power is in window functions, most other are there just for convenience.
ndarr = np.random.randint(0,10000,size=(1000, 1000))
%timeit nd1 = vbt.nb.nanmax_nb(ndarr)
%timeit nd2 = np.nanmax(ndarr, axis=0)
np.array_equal(nd1, nd2)
Output:
809 µs ± 3.07 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
651 µs ± 1.61 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
True
Probably same for nanmean_nb etc.
The text was updated successfully, but these errors were encountered: