In R, when adding new data of unequal length to a data frame, the values repeat to fill the data frame:
df <- data.frame(first=c(1,2,3,4,5,6))
df$second &
How general of a solution are you looking for? I tried to make this a little less hard-coded:
import numpy as np
import pandas
df = pandas.DataFrame(np.arange(1,7), columns=['first'])
base = [1, 2, 3]
df['second'] = base * (df.shape[0]/len(base))
print(df.to_string())
first second
0 1 1
1 2 2
2 3 3
3 4 1
4 5 2
5 6 3