如何获得 python 中 log10 值的倒数?

how to get the inverse of a log10 value in python?

y=np.log10(train_set["SalePrice"])

我如何找到它的反函数??我希望它 return 回到原始值而不是缩放后的值

在这里查看对数反转:https://www.rapidtables.com/math/algebra/Logarithm.html

10 ** y 应该可以帮到你

如果你想获取原始值那么你可以这样做:

z = 10**y

希望以上答案对您有所帮助,以防您或任何人想要 log10(以 10 为底)和 log(自然)的倒数

# Logarithm and back to normal value
y = np.log10(train_set["SalePrice"])
train_set["SalePrice"] = 10 ** y

# Natural log and back to normal value using built-in numpy exp() function
y = np.log(train_set["SalePrice"])
train_set["SalePrice"] = np.exp(y)

y = np.log10(train_set["SalePrice"])

return所有数组元素恢复原值

Z = np.array(10**y)