I have some code that loops through files and grabs a datetime string and appends the string in each file to an empty list. I am trying to convert this list of strings into an array of strings:
timestamp=[]
line = open(filename).readlines()
lines = line[0::24]
for i in lines:
time=i[7:27]
timestamp.append(time)
timestamp=np.array(timestamp)
I get this error:
ValueError: setting an array element with a sequence
The timestamp list looks like this:
[' 04/23/2014 00:00:00', ' 04/23/2014 00:10:00', ' 04/23/2014 00:20:00', ' 04/23/2014 00:30:00', ' 04/23/2014 00:40:00', ' 04/23/2014 00:50:00', ' 04/23/2014 01:00:00', ' 04/23/2014 01:10:00', ' 04/23/2014 01:20:00', ' 04/23/2014 01:30:00', ' 04/23/2014 01:40:00', ' 04/23/2014 01:50:00', ' 04/23/2014 02:00:00', ' 04/23/2014 02:10:00', ' 04/23/2014 02:20:00', ' 04/23/2014 02:30:00', ' 04/23/2014 02:40:00', ' 04/23/2014 02:50:00', ' 04/23/2014 03:00:00', ' 04/23/2014 03:10:00']
I am not sure why I can't turn this into an array so that I can write it to a column in a csv file with other arrays. This should be working so I am not sure why it wouldn't. Any ideas would be appreciated!