I would like to read multiple CSV files with python 3.6, skip the header and stop at the first empty row. Then i would like to extract only the fourth column of each csv file an fill into an array but sorted like shown at the end.
My Files: CSV Files
Thats my code so far but i'm not happy with the output order and maybe there is a more elegant way?
csvdata_d=[]
for i in range(timestep): # timestep = number of files
with open(csvname[i]) as f:
reader = csv.reader(f)
readerlist=list(reader)
for row in readerlist[2:]: # skip two header lines
if len(row) == 0: # empty line definition
break
else:
row=list(row)
csvdata_d.append(row[3]) # fourth column
print(csvdata_d)
My output is: csvdata_d=['1.1', '1.2', '1.3', '2.1', '2.2', '2.3', '3.1', '3.2', '3.3']
But i want it to be [['1.1','2.1','3.1'],['1.2','2.2','3.2'],['1.3','2.3','3.3']]
Thanks for your help.