I am a total beginner in Python, so sorry if it is trivial but I can't solve the problem.
I have 3 lists containing floats.
mouse_x = [-0.01, -0.01, -0.01, -0.01, -0.01, -0.01, -0.01, -0.01, -0.01, -0.01]
mouse_y = [-0.14888888888888888, -0.14888888888888888, -0.14888888888888888, -0.14888888888888888, -0.14888888888888888, -0.14888888888888888, -0.14888888888888888, -0.14888888888888888, -0.14888888888888888, -0.14888888888888888]
mouse_time = [1.5307196849607863, 1.581636800954584, 1.6135933389887214, 1.6362467749859206, 1.6675526530016214, 1.6996790579869412, 1.7314749069628306, 1.7635557259782217, 1.7962380870012566, 1.826124977960717]
What I want to do is to combine these three variables so that they are the 3 columns of my CSV file. It should look the following way:
mouse_x, mouse_y, mouse_time
-0.01, -0.14888888888888888, 1.5307196849607863
-0.01, -0.14888888888888888, 1.581636800954584
-0.01, -0.14888888888888888, 1.6135933389887214
...
...
This is what I have tried:
with open('my_file.csv', 'w', newline='') as f:
thewriter = csv.writer(f)
thewriter.writerow(['mouse_x', 'mouse_y', 'mouse_time'])
counter = 0
for x in mouse_x_list:
thewriter.writerows(mouse_x_list[counter], mouse_y_list[counter], mouse_time_list[counter])
counter +=1
This produces the following error:
TypeError: writerows() takes exactly one argument (3 given)