gpt4 book ai didi

python "TypeError: ' numpy.float6 4' object cannot be interpreted as an integer"

转载 作者:太空狗 更新时间:2023-10-29 17:17:17 32 4
gpt4 key购买 nike

import numpy as np

for i in range(len(x)):
if (np.floor(N[i]/2)==N[i]/2):
for j in range(N[i]/2):
pxd[i,j]=x[i]-(delta*j)*np.sin(s[i]*np.pi/180)
pyd[i,j]=y[i]-(delta*j)*np.cos(s[i]*np.pi/180)

else:
for j in range((N[i]-1)/2):
pxd[i,j]=x[i]-(delta*j)*np.sin(s[i]*np.pi/180)
pyd[i,j]=y[i]-(delta*j)*np.cos(s[i]*np.pi/180)

有没有人有解决这个问题的想法?运行这些代码成功地?

最佳答案

N=np.floor(np.divide(l,delta))
...
for j in range(N[i]/2):

N[i]/2 将是一个 float64range() 需要一个整数。只需调用电话即可

for j in range(int(N[i]/2)):

关于 python "TypeError: ' numpy.float6 4' object cannot be interpreted as an integer",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24003431/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com