At least you can become familiar with what the most used Python's modules are used for and what they are capable. That way when you start a project you will know that there are alternative/different way to do something and you can do deeper research about it. And eventually, use it. Numpy is fast. Really fast.
I don't know NumPy and I have never used it but because of this topic, I google it just a bit to make an example. I just know that it's fast. So here is how much.
Consider I have opened two browsers Chrome and Firefox with 118 and 499 tabs. ;)
I don't know NumPy and I have never used it but because of this topic, I google it just a bit to make an example. I just know that it's fast. So here is how much.
In [1]: import math In [2]: nums = list(range(2, 100001)) In [3]: def power_it(numbers): ...: return [math.pow(num, 5) for num in numbers] ...: In [4]: %timeit power_it(nums) 22.6 ms ± 2.65 ms per loop (mean ± std. dev. of 7 runs, 10 loops each) In [5]: import numpy as np In [6]: def np_pow(numbers): ...: return np.power(numbers, 5) ...: In [7]: %timeit np_pow(nums) 4.89 ms ± 14.9 µs per loop (mean ± std. dev. of 7 runs, 100 loops each) In [8]: l = np.array(nums) In [9]: %timeit np_pow(l) 258 µs ± 1.39 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)I have to thank you for that because I'm planning to use it constantly now. I am surpriced
Consider I have opened two browsers Chrome and Firefox with 118 and 499 tabs. ;)