Here's a basic question for you guys, but I have searched but not found the answer around this and other sites.
I want to write data collected in for example two lists, let's say every 15minutes, one list for data from a sensor and the other for the logging date and time. The problem is that I can't find the correct datetime format to be written into the csv file. Here's a short verion of my code, with random data instead of sensor data, and the currend date.time instead of waiting 15 min.
import numpy as np
from random import randint
import csv
import datetime
a=[]
b=[]
for p in range (1,20):
i = datetime.datetime.now()
i=i.strftime('%Y/%m/%d %H:%M:%S')
i=str(i) #also tried without this line
a.append(i)
b.append(randint(0,26))
np.savetxt('data.csv', (a,b),delimiter=',')
Gives two errors. 'A float is required' and 'Mismatch between array dtype ('<19') and format specifier ('%.18e,%.18e,...). I would really appreciate hints on this.