Suppose I have list
a = ["0-3","4-7","8-11","12-15","16-19","20-23"]
I want to repeat all elements in the list for a new column in a dataframe which has 1000 rows. How to do that in pandas?
Suppose I have list
a = ["0-3","4-7","8-11","12-15","16-19","20-23"]
I want to repeat all elements in the list for a new column in a dataframe which has 1000 rows. How to do that in pandas?
Please refer to my comment, but if I understand you correctly you need:
import pandas as pd
a_list = (["0-3","4-7","8-11","12-15","16-19","20-23"]*167)[:1000]
series = pd.Series(a_list)
print(series)
0        0-3
1        4-7
2       8-11
3      12-15
4      16-19
       ...
995    20-23
996      0-3
997      4-7
998     8-11
999    12-15
Length: 1000, dtype: object
