Numpy Flashcards
1
Q
How do you add a dimension to a numpy array?
A
y[:,None]
2
Q
How do you add a numpy vector y (shape (n,)) to every column of a numpy array arr?
A
arr + y[:,None]
How do you add a dimension to a numpy array?
y[:,None]
How do you add a numpy vector y (shape (n,)) to every column of a numpy array arr?
arr + y[:,None]