What is the quickest/simplest way to drop nan and inf/-inf values from a pandas.DataFrame without resetting mode.use_inf_as_null?

I’d like to be able to use the subset and how arguments of dropna, except with inf values considered missing, like:

df.dropna(subset=["col1", "col2"], how="all", with_inf=True)

Is this possible? Is there a way to tell dropna to include inf in its definition of missing values?

10 Answers
10

Leave a Reply

Your email address will not be published. Required fields are marked *