I've written the following simple code to illustrate an issue I'm having:
import pandas as pd
symbols = {'TEST1', 'TEST2', 'TEST3'}
i = 0
for sym in symbols:
if i == 0:
cum_df = pd.DataFrame([sym])
i = 1
else:
cum_df.append(pd.DataFrame([sym]), ignore_index=True)
cum_df
I was expecting cum_df
to look like this:
+---+-------+
| | 0 |
+---+-------+
| 0 | TEST1 |
| 1 | TEST2 |
| 2 | TEST3 |
+---+-------+
But instead it looks like this:
+---+-------+
| | 0 |
+---+-------+
| 0 | TEST3 |
+---+-------+
Where am I going wrong?