numpy.core._exceptions.UFuncTypeError: Cannot cast ufunc 'solve' input 1 from dtype('O') to dtype('complex128') with casting rule 'same_kind'
В общем, есть такой участок кода:
if 1 == faulted_phase:
dist_km[16] = numpy.imag(vbeg(1) * numpy.conj(Ibeg_0) * np.exp(1j * beta)) / numpy.imag(
z1 * (ibeg(1) + K_10 * Ibeg_0) * numpy.conj(Ibeg_0) * np.exp(1j * beta))
else:
if 2 == faulted_phase:
dist_km[16] = numpy.imag(vbeg(2) * numpy.conj(Ibeg_0) * np.exp(1j * beta)) / numpy.imag(
z1 * (ibeg(2) + K_10 * Ibeg_0) * numpy.conj(Ibeg_0) * np.exp(1j * beta))
else:
if 3 == faulted_phase:
dist_km[16] = numpy.imag(vbeg(3) * numpy.conj(Ibeg_0) * np.exp(1j * beta)) / numpy.imag(
z1 * (ibeg(3) + K_10 * Ibeg_0) * numpy.conj(Ibeg_0) * np.exp(1j * beta))
else:
raise Exception('Нет повреждённой фазы.')
Выдает такую ошибку:
numpy.core._exceptions.UFuncTypeError: Cannot cast ufunc 'solve' input 1 from dtype('O') to dtype('complex128') with casting rule 'same_kind'.
Как можно пофиксить?