好的,所以我有一个从CSV文件加载的numpy数组,该数组看起来像:array([['0', '3', '22', ..., '7.25', '1', '0'], ['1', '1', '38', ..., '71.2833', '0', '0'], ['1', '3', '26', ..., '7.925', '1', '0'], ..., ['0', '3', '', ..., '23.45', '1', '0'], ['1', '1', '26', ..., '30', '0', '0'], ['0', '3', '32', ..., '7.75', '0', '0']], dtype='|S8')我想将数组元素转换为浮点型,但出现此错误data2 = np.array(data).astype(np.float)Traceback (most recent call last): File "<input>", line 1, in <module>ValueError: could not convert string to float: 有没有办法用numpy或pandas解决此问题?
添加回答
举报
0/150
提交
取消