您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

python + numpy:如果numpy.log的操作数太大,为什么会抛出属性错误?

python + numpy:如果numpy.log的操作数太大,为什么会抛出属性错误?

的结果math.factorial(21)是Python长。numpy无法将其转换为其数字类型之一,因此将其保留为dtype=object。一元函数对对象数组的工作方式是,它们只是尝试在对象上调用相同名称方法。例如

np.log(np.array([x], dtype=object)) <-> np.array([x.log()], dtype=object)

由于.log()Python上没有方法,因此您可以得到AttributeError

python 2022/1/1 18:27:13 有169人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶