In R, I can easily add a smaller vector to a larger vector (assuming length of larger vector is a multiple of length of smaller vector)
a <- seq(1,10,1)
# [1] 1 2 3 4 5 6 7 8 9 10
b <- seq(1,2,1)
# [1] 1 2
a+b
# [1] 2 4 4 6 6 8 8 10 10 12
Is there an easy way to do this in Python?
import numpy as np
a = np.arange(1, 10)
# array([1, 2, 3, 4, 5, 6, 7, 8, 9])
b = np.arange(1,4)
# array([1, 2, 3])
What I tried
a + b?
np.add(a, b)?