Input:
mp = [1,2,3,4]
tw = [4,7,3,5]
cw = []
# create the data frame:
df = pd.DataFrame((cw),
columns = ["1","2","3","4"])
# add list tw to the first row
df.loc[len(df)] = tw
df
Output:
1 2 3 4
0 4 7 3 5
Desired Output:
1 2 3 4
0 4 7 3 5
1 5 8 4 6
2 6 9 5 7
... ... ... ... ...
3000 3003 3006 3002 3004
Starting from an initial reference row of list "tw" I need to add 1 to the starting value and keep going. How do I loop and keep creating rows so that the next row is the previous row +1, I need to do this for 3000 rows. A lot of solutions I've seen require me to create lists and add to the pandas dataframe however I cannot manually create 3000 lists and then manually add them to my dataframe. There must be a way to loop over this, please help!