-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Add strict_na
keyword to the assert_.._equal methods for object dtype to help with deprecation
#58072
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
base: main
Are you sure you want to change the base?
Add strict_na
keyword to the assert_.._equal methods for object dtype to help with deprecation
#58072
Conversation
… to help with deprecation
Is the idea to keep this forever or just a lengthened deprecation cycle? could be modestly be more strict by disallowing egregiously mismatched cases e.g. np.dt64(nat) vs np.td64(nat)? |
No, it's actually just to make it easier to use, because for certain use cases the previous behaviour was a lot more convenient (so the title "help with deprecation" is a bit wrong, it's not to help with the deprecation process itself, but just to help live with the new enforced behaviour). |
That again would then make the keyword logic and implementation more complex. So unless there is a use case for this, I personally wouldn't do that. |
What is the envisioned scope of this keyword? Does it treat None, pd.NA, pa.null and np.nan all the same? Or just a subset of those? |
It will treat anything that |
This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this. |
@@ -67,6 +67,7 @@ cpdef assert_almost_equal(a, b, | |||
Absolute tolerance. | |||
check_dtype: bool, default True | |||
check dtype if both a and b are np.ndarray. | |||
strict_na : bool, default True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one-liner on the docstring as to what this means
docstring request, otherwise LGTM pending green |
Adding a
strict_na=False
option to our assert functions (the default ofTrue
keeps the new behaviour enforced on main). This keyword is only relevant for object dtype (or when using that code path when specifyingcheck_dtype=False
and having different dtypes).This was brought up in the original PR, see #52081 (comment), and also discussed in the original issue (#18463)
This obviously needs some more docstring and test updates, but first wanted to see how this is received
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.