The code down below finds the index of newdates within Setups with the init_location function. Then I increment the index by one to get the next date. But I cannot add to the init_location function. How would I be able to do that and get the expected value?
import numpy as np
Setups = np.array(['2017-09-15T07:11:00.000000000', '2017-09-15T11:25:00.000000000',
'2017-09-15T12:11:00.000000000', '2017-12-22T03:14:00.000000000',
'2017-12-22T03:26:00.000000000', '2017-12-22T03:31:00.000000000',
'2017-12-22T03:56:00.000000000'],dtype="datetime64[ns]")
newdates = np.array(['2017-09-15T07:11:00.000000000','2017-12-22T03:26:00.000000000'],dtype="datetime64[ns]")
init_location= np.where(np.in1d(Setups,newdates[1]))
print("init location: ", Setups[init_location],"Address right after: ",Setups[init_location+1])
Output Error
TypeError: can only concatenate tuple (not "int") to tuple
Expected Output
init location: 2017-12-22T03:26:00. Address right after: 2017-12-22T03:31:00.00
init_location = np.nonzero(np.in1d(Setups, newdates[1]))[0][0]