Numpy Flashcards

1
Q

How do you add a dimension to a numpy array?

A

y[:,None]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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 well did you know this?
1
Not at all
2
3
4
5
Perfectly