Geek Culture
Published in

Geek Culture

5 Advanced Vectorisation Techniques for Improved Python Performance

Use NumPy to speed up your code.

Photo by Charlotte Coneybeer on Unsplash

NumPy vectorisation applies a function to an entire array in one call. For example:

a = np.array([1, 2, 3])
b = np.array([4, 5, 6])
u = np.sqrt(a) # [1. 1.414 1.732]
v = a + b # [5 7 9]

--

--

--

A new tech publication by Start it up (https://medium.com/swlh).

Recommended from Medium

Snowflake: 10 Things Every Snowflake Admin Should be Doing to Optimize Credits

Mysql client for Linux and Mac

Important guidelines for GSOC

Why is Linux the Best Choice for Programmers

How To Create Liquid Swipe Animation In Flutter

Buy Verified Cash App Account with BTC Enable

Spantastic text styling with Spans

Retrieving data from api and storing in Json file (Python)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Martin McBride

Martin McBride

Software developer. Java, Python, C++ etc. I write for pythoninformer.com and maintain the generativepy library.

More from Medium

PyCharm is the Best Editor for Python

How to implement a Timeout functionality in Python

Enhance Python Performance with Cython, Numba, and Eval()

12 Ways to Use Function Decorators to Improve Your Python Code