-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
BugMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatenp.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Description
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
I have confirmed this bug exists on the master branch of pandas.
Reproducible Example
import numpy as np
import pandas as pd
idx = pd.Index([np.inf, np.nan], dtype=np.float64)
assert (pd.isna(idx) == idx.isna()).all()
pd.set_option("use_inf_as_na", True)
assert (pd.isna(idx) == idx.isna()).all() # <- nope!
Issue Description
pd.isna(obj) and obj.isna() are generally interchangeable, but pd.Index caches .isna in a _isnan cache_readonly. If we want to maintain that interchangeability, we'd need to invalidate that cache.
My inclination is that it isn't worth futzing around with, but someone who uses use_inf_as_na=True might care more.
Expected Behavior
assert (pd.isna(idx) == idx.isna()).all()
Installed Versions
Replace this line with the output of pd.show_versions()
Metadata
Metadata
Assignees
Labels
BugMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatenp.nan, pd.NaT, pd.NA, dropna, isnull, interpolate