I made a for loop that creates a different pandas dataframe on each iteration. Something like this -> First iteration:
| index | Letter | Value |
|---|---|---|
| 0 | A | 1 |
| 1 | B | 2 |
| 2 | C | 3 |
Second iteration:
| index | Letter | Value |
|---|---|---|
| 0 | C | 5 |
| 1 | D | 3 |
| 2 | E | 1 |
| 3 | F | 2 |
Third iteration:
| index | Letter | Value |
|---|---|---|
| 0 | A | 2 |
| 1 | F | 1 |
I want to save each dataframe to a new one that looks like this:
| index | Letter | Value | Value | Value |
|---|---|---|---|---|
| 0 | A | 1 | 2 | |
| 1 | B | 2 | ||
| 2 | C | 3 | 5 | |
| 3 | D | 3 | ||
| 4 | E | 1 | ||
| 5 | F | 2 | 1 |
Also, new letters can appear on each iteration, so for example if 'G' appears for the first time on interation 'n', a new row would need to be created on the desired consolidated dataframe.