Help correct the error. I have the following error:

TypeError: only length-1 arrays can be converted to Python scalars

Code snippet where an error is issued:

 M = 216 t1 = np.linspace(a, b, M) f1 = np.interp(t1, z1, a1) f1_not_nan = f1 f1_not_nan[math.isnan(f1)] = np.array([]) 

I think that there is a problem in f1 = np.interp(t1, z1, a1) , but I don’t know how to fix it. If you have ideas, tell me.

  • and on what line the error gets out? - rnd_d
  • gives an error on the line f1_not_nan [math.isnan (f1)] = np.array ([]) - Romashka
  • Already found a mistake - Romashka