I have an array consisting of 1 column and 1980796 rows full of dates. The date type is the following: '2018-01-01 00:00:00 +01:00' I am trying to split the date in two different arrays, one according to each day and the other to the hour. Here is the part of the code which i am working on to extract those two arrays:
time=np.array(parameters[:,2])
time1=time.astype(str)
month=[]
hour=[]
for i in (time1):
month.append(i.split(' ')[0])
hour.append(i.split(' ')[1])
month1=np.array(month)
hour1=np.array(hour)
When i run the code i recieve the following error:
Traceback (most recent call last):
File "<ipython-input-136-3cf951a10e93>", line 12, in <module>
hour.append(i.split(' ')[1])
IndexError: list index out of range
Finally, when i ckeck the shape of the new arrays is different that the time1 array. I want just to split the dates and get two new arrays with the same shape as the initial array in all the indices.