I have some quarter level data for finance deals, so a pretty big dataset. I now want to add the following values to a new column repeated over and over:
[-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12]
The column should then look something like this:
A
-12
-11
-10
...
11
12
-12
-11
...
11
12
So basically just that list repeating over and over until the last row of my Dataframe. I hope this question is clear enough.
Try this:
N = len(df)
df['A'] = pd.Series(np.tile(lst, N//len(lst))).iloc[:N]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With