淘先锋技术网

首页 1 2 3 4 5 6 7
    aera['down_aera'] = df_10minv1.iloc[:, : 6].apply(lambda x: sum(\
        [0.5*(abs(i[0][0])/(abs(i[0][0])+abs(i[0][1])))*i[1]*i[0][0]*(1-(i[0][1]/i[0][0])^2) if i[0][0]*i[0][1] < 0 \
             else 0.5*(i[0][0]+i[0][1])*i[1] for i in zip(zip(x[:-1], x[1:]), height[:5])]), axis=1)
  File "<ipython-input-2-d13201129b59>", line 2, in <lambda>
    [0.5*(abs(i[0][0])/(abs(i[0][0])+abs(i[0][1])))*i[1]*i[0][0]*(1-(i[0][1]/i[0][0])^2) if i[0][0]*i[0][1] < 0 \
  File "<ipython-input-2-d13201129b59>", line 2, in <listcomp>
    [0.5*(abs(i[0][0])/(abs(i[0][0])+abs(i[0][1])))*i[1]*i[0][0]*(1-(i[0][1]/i[0][0])^2) if i[0][0]*i[0][1] < 0 \
TypeError: unsupported operand type(s) for ^: 'float' and 'int'

修改:
把 a^2 表示a的2次方,改为 a**2,也是表示a的2次方
参考:https://blog.csdn.net/chundongg/article/details/98889600