https://medium.com/@serdarilarslan/boosting-python-performance-from-for-loops-to-vectorization-6ccc718903c7