I have a 2D array from a function f.example which returns me:
array([[ 0.0, 1.0, 2.0, 3.0 ],
[ 5.0, 1.0, 3.0, 3.0 ],
[ 1.0, 1.0, 3.0, 3.0 ]])
In fact I am able to write it to a csv file, but just not the way I want. Here is how the csv file should look like:
0.0 5.0 1.0
1.0 1.0 1.0
2.0 3.0 3.0
3.0 3.0 3.0
But this is how it looks now:
0.0 1.0 2.0 3.0
5.0 1.0 3.0 3.0
1.0 1.0 3.0 3.0
And the code that I have:
with open('example.csv', 'w') as csvfile:
writer = csv.writer(csvfile)
writer.writerows(f.example)