I have a list that contains arrays (type = numpy.ndarray) in the following form:
final = [[a, b, c, d],[e, f, g, h],[i, j, k, l]]
and i would like to print them transposed in a csv file in the following form:
a, e, i
b, f, j
c, g, k
d, h, l
where a,b,c...j, k, l are all strings (numpy.string_). I tried to approach this as a list containing lists (which is answered in another post) but it does not work, instead in creates an empty csv file. My attempt was this one:
csvfile=open('new.csv','wb')
wr = csv.writer(csvfile)
final=map(list, zip(*final))
wr.writerows(final)
csvfile.close()
Can somebody offer some advice?