【发布时间】:2016-10-26 23:51:03
【问题描述】:
我是 numpy 的新手,但我似乎无法让这段代码工作。
item3.apply(lambda x : (x[np.isneginf(x)] = 0))
item3 是一个 numpy 数组的向量,每个数组有 300 个维度。
抛出的错误是无效的语法。如何实现这个功能。
但是,鉴于它是 float64 numpy 向量的向量。数据类型是对象。并抛出异常
TypeError: ufunc 'isinf' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
Item3 是一个包含元素的列,每个元素有 300 个维度
【问题讨论】:
-
“每个数组有 300 个维度”你的意思是 300 个元素吗?
-
是的,我的意思是这样