Say for the dataframe:
Ind d1 d2 d3
0 x0 x0 x0
1 x1 x1 x1
2 x2 x2 x2
...
n xn xn xn
I want to add a new column such that the 1 2 3 4 5 pattern is repeated until n is reached. i.e.
Ind d1 d2 d3 d4
0 x0 x0 x0 1
1 x1 x1 x1 2
2 x2 x2 x2 3
3 x3 x3 x3 4
4 x4 x4 x4 5
5 x5 x5 x5 1
6 x6 x6 x6 2
...
n xn xn xn (1,2,3,4 or 5 depending on n)