Vectors are of dimension 1.
We can switch from row vectors to column vectors using np.newaxis.
Or None.
Can we select loot values between 5 and 30?
What are the difficulty values of dungeons 1, 4 and 7 for floors 0, 2 and 3?
Where can I find object 8? Which objects are available in the range 10 to 20?
From a detailed table, can I get how many pieces each one got in last floors of dungeons?
We want to compute the contribution of each attribute point to the loot.
You can also use Einstein notation.
We want to compute the windowed average on 5 measurements.
Strides are virtual views on your array
that add virtual dimensions without
copying anything.
They are tricky to use
but can give huge performance boosts.
NumPy comes with a whole lot of unary and binary ufuncs (add, multiply, exponential, trigonometric functions, arithmetic operations, comparisons).
They support broadcasting,
reduce and accumulate operations.
What about more exotic ufuncs?
Remember the running average we computed earlier? Numba can help with that too!
For best performance, get out of Python as quickly as possible, and do not go back till the end.
Embrace the world of NumPy fully!
Almost everything you want to do probably already has an implementation... in NumPy, in SciPy or in scikit-learn.
Use it, it'll always be faster (and not bugged)!
When in difficulty, Numba will help you.
At least, it's worth a try.
Thank you for participating in this adventure!
sarah.diot-girard@people-doc.com
We're hiring ! And we have a RPG club!
Characters illustrations from here .