报错TypeError: only length-1 arrays can be converted to Python scalars
int(x)报错:TypeError: only length-1 arrays can be converted to Python scalars试试:x.astype(int)或者np.vectorize(x)
文章共47字 · 阅读需要大约1分钟
一键AI生成摘要,助你高效阅读
问答
·
int(x)报错:TypeError: only length-1 arrays can be converted to Python scalars
因为此函数只能传一个值进去,而你传了一个数组进去
试试:
x.astype(int)或者np.vectorize(x)
更多推荐
已为社区贡献4条内容
所有评论(0)