I have a problem using np.select in DateTime series. Imagine you have a DataFrame: dateframe['id','FLOAT','DATE1','DATE2']
dateframe['DATE1'] = dt.datetime.now()
dateframe['DATE2'] = dt.datetime.now()
dateframe['DATE3'] = np.select(
[
dateframe['FLOAT']>0,
dateframe['FLOAT']<=0,
],
[
dateframe['DATE1'],
dateframe['DATE2'],
]
)
I get this error:
TypeError: The DTypes <class 'numpy.dtype[uint8]'> and <class 'numpy.dtype[datetime64]'> do not have a common DType. For example they cannot be stored in a single array unless the dtype is object
.
Thanks in advance.