Drop rows in a pandas dataframe where values are close to zero

I have a list of coefficients that have been shrunk close to zero but not equal to zero, so I am looking for a way in which to remove these rows where the coefficients are close to zero, I do not know their exact values but they are non-zero. The usual method of:

df.loc[(df!=0).any(1)]

Does not seem to help in this case



Read more here: https://stackoverflow.com/questions/67384120/drop-rows-in-a-pandas-dataframe-where-values-are-close-to-zero

Content Attribution

This content was originally published by Nish at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: