Open
Description
The interp
function can not handle datetime64
dtypes (docs are not explicit about this; they state that x
and xp
should be values). Error message is that array cannot be cast to dtype('float64') according to the rule 'safe'
. But conversion seems easy.
Reproducing code example:
import numpy as np
d1 = np.datetime64('2019-01-01')
d2 = np.datetime64('2019-01-03')
xp = np.array([d1, d2])
yp = np.array([1, 3])
x = np.datetime64('2019-01-02')
np.interp(x, xp, yp) # produces error
while the following works fine
np.interp(x.astype('float64'), xp.astype('float64'), yp)
So why is that not done in the interp
function?