TypeError: loop of ufunc does not support argument 0 of type float which has no callable radians met

目录


遇到了下面的这个问题:

TypeError: loop of ufunc does not support argument 0 of type float which has no callable radians method

经查询了解到:

查询得知问题是数据列不是数值类型,而 np.log() 函数需要输入数值数据。查看我的数据发现数据对象均为 object,因此需要将数据框中的 object 数据转换为 float 类型,

进行如下操作:

df = pd.DataFrame(df, dtype=float)
print(np.log(df))

你可能感兴趣的:(bug,python,数据挖掘,开发语言)