为什么会出现“Float”对象没有“dtype”属性的错误?

2024-09-28 22:26:18 发布

您现在位置:Python中文网/ 问答频道 /正文

我有两个嵌套列表,我想计算两个列表中每个元素的剩余量。你知道吗

    Coeff_zeros = [(sympy.poly(expand(index_of_zero_e_m[i][1]), s).coeffs()) for i in violates]
    Coeff_zeros_index = list(zip(violates, Coeff_zeros))

以及

    Coeff_poles = [(sympy.poly(expand(index_of_est_pole_m[i][1]), s).coeffs()) for i in violates]

    Coeff_poles_index = list(zip(violates, Coeff_poles))

当我使用以下代码时,我得到了提到的错误:

from scipy.signal import residue

Modified_residues = [residue(Coeff_zeros_index[i][1],  Coeff_poles_index[i][1]) for i in violates] 

但是,当我在代码中复制并粘贴Coeff_zeros_indexCoeff_poles_index的结果时,相同的代码不会有任何问题。有什么问题,我该怎么办?为什么打印结果可以解决错误? 我不能每次在代码中复制和粘贴两个列表的结果。你知道吗

当我打印Coeff_poles_index时,我会得到: Coeff_poles_index = [(0, [1.00000000000000, 5426987090.44496]), (1, [1.00000000000000, 1207636905.04548]), (2, [1.00000000000000, 590484627.473621, 8.12581014483133e+19])]

Coeff_zeros_index的结果是: Coeff_zeros_index = [(0, [1.00000000000000, 80787271317.5307]), (1, [1.00000000000000, 13905630041.1712]), (2, [1.00000000000000, 332812172952.372, 4.17475738734003e+20])


Tags: of代码in列表forindexzeroslist