Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Series.hasnans shouldn't be cached #19700

Closed
jbrockmendel opened this issue Feb 14, 2018 · 2 comments · Fixed by #21861
Closed

Series.hasnans shouldn't be cached #19700

jbrockmendel opened this issue Feb 14, 2018 · 2 comments · Fixed by #21861
Labels
Bug Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Milestone

Comments

@jbrockmendel
Copy link
Member

Series.hasnans is as a cache_readonly inherited from IndexOpsMixin

ser = pd.Series([0, 1.0])
>>> ser.hasnans
False
ser.iloc[0] = np.nan
>>> ser.hasnans
False
@TomAugspurger
Copy link
Contributor

I wonder if that's intended to be Index only? Might want to just deprecate it in favor of .isna().any().

@jbrockmendel
Copy link
Member Author

I was thinking of adding an _immutable flag to Index/NDFrame(/Array) and a decorator cache_if_immutable that acts like cache_readonly for if obj._immutable and like property otherwise. There's a bunch of stuff (in datetimes/timedeltas/periods, where else) like this that could make use of it.

@gfyoung gfyoung added Bug Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate labels Feb 15, 2018
jbrockmendel added a commit to jbrockmendel/pandas that referenced this issue Jul 11, 2018
@jreback jreback added this to the 0.24.0 milestone Jul 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Projects
None yet
4 participants