In this article we are going to be discussing some of the new features available in the new release of Numpy which you can test out in deepnote!
NumPy is pretty fundamental when it comes to working with numbers in Python. It is used in nearly every scientific python library. It has plenty of simple and efficient ways of modifying and working with Python lists and Matrices. Numpy also keeps your code simple and fast because in the background it's using precompiled C code so you get the simplicity of coding in Python with all the speed of C. Often times you'll never consciously decide to work with NumPy because it was already a requirement of your toolset to begin with.
As said previously anytime youre working with numbers or vectors, you'll end up working with Numpy. Numpy is required by transformers, torch, spacy, scipy, scikit-learn, pandas, matplotlib, Keras and Tensorflow just to name a few. You'll be using it if youre doing anything scientific in Python Numpy will be there.
In their own words
This NumPy release is the largest so made to date, some 684 PRs contributed by 184 people have been merged. See the list of highlights below for more details. The Python versions supported for this release are 3.7-3.9, support for Python 3.6 has been dropped. Highlights are
- Annotations for NumPy functions. This work is ongoing and improvements can be expected pending feedback from users.
- Wider use of SIMD to increase execution speed of ufuncs. Much work has been done in introducing universal functions that will ease use of modern features across different hardware platforms. This work is ongoing.
- Preliminary work in changing the dtype and casting implementations in order to provide an easier path to extending dtypes. This work is ongoing but enough has been done to allow experimentation and feedback.
- Extensive documentation improvements comprising some 185 PR merges. This work is ongoing and part of the larger project to improve NumPy’s online presence and usefulness to new users.
- Further cleanups related to removing Python 2.7. This improves code readability and removes technical debt.
- Preliminary support for the upcoming Cython 3.0
Numpy has a few new functions out with the latest release!
One such new function is the
numpy.broadcast_shapes function. If you don't know about array broadcasting feel free to read more about it here but the new function will let you know what the resulting array shape will be when two shape tuples are broadcasted against each other.
From Numpys own examples:
Test it out in Deepnote!