0

While data wrangling in python, using pandas from a csv file, how to deal with -inf values which might arise when making a column for percentage change calculations? Suppose you have a data which you loaded to python using pandas as dataframe. Then, you create another column which has values of Percentage Change between say any two columns in your data. Some values you inspect to be -inf. How to deal with them, especially when you are cleaning the data to be fed as training data set.

  • you should be knowing what to do which such values , may be replace them with another value. but generally speaking asking for opinions / recommendations is off-topic in SO – anky Apr 18 '20 at 16:26

1 Answers1

0

The values normally come up as NaN. So use df.dropna() or df.fillna().

Nathan Thomas
  • 260
  • 1
  • 8