I have a float array (created by: array('f')) and I want to write its contents as a 1-column CSV file, that is, each element of the array will take one line of the resulting file.
from array import array
my_array = array('f')
with open(filename, 'w') as output:
my_array = populate_method()
writer = csv.writer(output)
print(my_array) # verifying that the data exist
writer.writerows(my_array.tolist())
I get this error at the latest line: _csv.Error: sequence expected.
What is wrong? Isn't the list a sequence?