https://medium.com/@pranoypaul/replace-for-loops-in-python-with-vectorized-pandas-dataframes-and-numpy-arrays-e62cf8fbc72a