I would like to get that entries of an datetime numpy array back that are bigger then my input datetime variable.
Unfortunately, I get this error when executing the code below:
TypeError: '>' not supported between instances of 'int' and 'datetime.datetime'
This is my code:
import numpy as np
import pandas as pd
myRange = pd.date_range('2018-04-09', periods=5, freq='1D20min')
myArray = np.array(myRange).astype(np.datetime64).reshape(-1,1)
print("myArray:", myArray)
myDatetime = pd.datetime(2018,4,10,2,59,59)
myArray[myArray>myDatetime]
.
myArray: [['2018-04-09T00:00:00.000000000']
['2018-04-10T00:20:00.000000000']
['2018-04-11T00:40:00.000000000']
['2018-04-12T01:00:00.000000000']
['2018-04-13T01:20:00.000000000']]