My dataset contains values like NaN, inf, etc. During data preprocessing, I want to remove these kinds of values that I have to check in my data. I’m a beginner and don’t know much about handling them. During the research, I found a method but I’m not sure about its working.Can someone explain the code I showed above and share with me some ways to check these special numbers in my data?
You can use the
isfinite() method too for doing the same thing, it is an alternate method for your task and this function returns a Boolean array of the same shape as the input array, where each element is
True if the corresponding element in the input array is a finite number (i.e., not NaN or infinity), and
False otherwise. Here is a code that uses this function: