As a result, the time array is just a Numpy Array , you can use standard Numpy methods to control them, such as numpy # insert , which returns a modified array with new elements inserted into it. Usage examples from Numpy docs (here np short for numpy ):
>>> a = np.array([[1, 1], [2, 2], [3, 3]]) >>> a array([[1, 1], [2, 2], [3, 3]]) >>> np.insert(a, 1, 5) array([1, 5, 1, 2, 2, 3, 3]) >>> np.insert(a, 1, 5, axis=1) array([[1, 5, 1], [2, 5, 2], [3, 5, 3]])
In addition, numpy#insert faster than numpy#resize :
>>> timeit np.insert(time, 1, 1, 1) 100000 loops, best of 3: 16.7 us per loop >>> timeit np.resize(time, (20,1)) 10000 loops, best of 3: 27.1 us per loop