NumPy is a Python library that provides a way to manipulate multidimensional arrays faster and easier.
I learned today that you can multiple NumPy array with a scalar value as easy as this:
I still don't understand why it works when you can't do this using Python's
It is awesome! I now understand why Python is so popular among scientists.
Suppose you want to multiple the following matrix:
[1,2,3]  [4,5,6] *  [7,8,9] 
You write it in Python using Numpy like the following:
import numpy as np m = np.array([[1,2,3],[4,5,6],[7,8,9]]) c = np.array([0,1,2]) results= m * c[:, np.newaxis] print(results)
[[ 0 0 0] [ 4 5 6] [14 16 18]]