I am attempting to create a spreadsheet housing the time, open, high, low, close, volume, and volume MA for three different securities, but my code puts all of the data into the second column of the .csv file.
I have tried str.split(',')
and delaminate = ','
but it does not work. I would like the information spread out across seven columns. Here is my code:
import pandas as pd
sec = ["SPX", "QQQ", "IWM"]
t = "1s"
# create empty list
df1 = pd.DataFrame()
for note in sec:
with open(f'{note}_{t}.csv') as file:
temp = pd.DataFrame(file)
df1 = pd.concat([df1, temp], ignore_index = True)
print(df1)
Here is the output:
0 time,open,high,low,close,Volume,Volume MA\n
1 2022-10-27T08:30:02Z,3838.63,3838.63,3838.63,3...
2 2022-10-27T08:30:03Z,3838.63,3839.32,3838.63,3...
3 2022-10-27T08:30:04Z,3838.975,3839.21,3838.975...
4 2022-10-27T08:30:06Z,3839.0925,3840.9,3839.092...
... ...
131761 2022-10-28T15:04:04Z,3901.068892,3901.07,3901....
131762 2022-10-28T15:04:20Z,3901.069446,3901.069446,3...
131763 2022-10-28T15:04:21Z,3901.064723,3901.064723,3...
131764 2022-10-28T15:04:30Z,3901.057361,3901.06,3901....
131765 2022-10-28T15:04:40Z,3901.058681,3901.07,3901....
[131766 rows x 1 columns]