我只想使用 Python 将在 Matlab 中完成的以下操作执行到字段计算器中:
p(p==0) = 0.001 ; p(p == 1) = 0.999;
tVar = .5*log(p ./ (1 - p))
该操作由 Logit 变换组成:
- 找到 0 和 1 并分别替换为 .001 和 .999,然后
- 用对数执行第二次计算
我在 Python 中为 1) 尝试了以下操作,但无济于事:
前置逻辑脚本代码:
def iLogit(a):
return [.0001 if x==0 else x for x in a]
有一个错误:
> A field name was not found or there were unbalanced quotation marks.
> ERROR 999999: Error executing function. Failed to execute
> (CalculateField).
请问有什么帮助吗?