You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
If I'm not mistaken, np.ndarray.astype always makes a copy, while np.asfarray (with the appropriate flags) only makes one as necessary, so might be a better choice.
The
interp
function can not handledatetime64
dtypes (docs are not explicit about this; they state thatx
andxp
should be values). Error message is that array cannot be castto dtype('float64') according to the rule 'safe'
. But conversion seems easy.Reproducing code example:
while the following works fine
So why is that not done in the
interp
function?The text was updated successfully, but these errors were encountered: