1 Mayıs 2022 Pazar

Dealing with the problem of infinite values after log transformation

 Sometimes, when you do log transformation in highly skewed data, your zeros may be minus infinite.

Here's how you deal with it. (replacing infinite values with zeros and checking if they are still infinite or not)


test["Departure_Delay_in_Mins_log"] = np.log(test["Departure_Delay_in_Mins"])
test[test == -np.inf].count()
test=test.replace([np.inf, -np.inf], 0)
test[test == -np.inf].count()
test.drop('Departure_Delay_in_Mins', axis=1, inplace=True)

Hiç yorum yok:

Yorum Gönder