Python Forum

Full Version: interp2d casting ruled not 'safe'
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Trying to use interp2d in the following context :

Traceback (most recent call last):
    File "<console>", line 1, in <module>
    File "C:\Users\user\Desktop\Stage\Python\stability.py", line 495, in stable
    p_W.append(W_L10(V,U1[i],TU1[i],OOD,soil,Su,gamma_soil))
    File "C:\Users\user\Desktop\Stage\Python\stability.py", line 312, in W_L10
    L_N3=interp2d(mGc,mM,Matrix)(Gc,M)
    File "c:\users\user\miniconda3\lib\site-packages\scipy\interpolate\interpolate.py", line 307, in __call__
    z = fitpack.bisplev(x, y, self.tck, dx, dy)
    File "c:\users\user\miniconda3\lib\site-packages\scipy\interpolate\_fitpack_impl.py", line 1047, in bisplev
    z, ier = _fitpack._bispev(tx, ty, c, kx, ky, x, y, dx, dy)

    TypeError: Cannot cast array data from dtype('O') to dtype('float64') according to the rule 'safe'
I have printed the values concerned in interp2d which are in order Gc,M,mGc,mM,Matrix : 0.7258476098065036

1.05986517918965e-11

[0.556, 1.11]

[0.0, 0.2]

[[5.69828841092783, 8.43276280371185], [5.69828841092783, 8.43276280371185]]

I know there's a very similar post at numpy array casting ruled not 'safe' but haven't been able to solve the problem ...