- #1
- 53
- 6
I am iterating over 2 variables below and after the calculation are done, i'd like to append the dataframe to add the rows after each iteration, but what is happening now is that the row is getting replaced instead of getting added.
how do i ensure that at every iteration a new row will be added instead of replacing the existing one? Thanks
Python:
pre = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
post = [0, 1, 2, 3, 4, 5]
for i in pre:
for j in post:
results = pd.DataFrame(index=None)
row = pd.DataFrame({'pre':i, 'post:j})
results = results.append(row, ignore_index=True)
how do i ensure that at every iteration a new row will be added instead of replacing the existing one? Thanks