Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

python

inverse

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

how do i find inverse of this ?? I want it to return back to the original value and not the scaled value

like image 600
user9093127 Avatar asked Nov 28 '22 20:11

user9093127


2 Answers

have a look here for logarithm inversion: https://www.rapidtables.com/math/algebra/Logarithm.html

10 ** y should do the trick for you here

like image 178
Piotrek Avatar answered Dec 20 '22 01:12

Piotrek


Hope the above answers were helpful, in case you or anyone want the inverse for log10 (base 10) and log (natural)

# 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)
like image 33
jcdevilleres Avatar answered Dec 20 '22 02:12

jcdevilleres