-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
ddof vs correction kwargs in std/var #8573
base: main
Are you sure you want to change the base?
Conversation
@@ -571,7 +571,7 @@ def std( | |||
dim: Dims = None, | |||
*, | |||
skipna: bool | None = None, | |||
ddof: int = 0, | |||
ddof: int | None = None, |
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.
I know that I'm supposed to regenerate these files instead of changing them directly, but I don't understand why when I change this directly ddof=0
still gets passed down explicitly.
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.
I can't reproduce that. What code do you use to see that behavior? However, if you tried Dataset.std
, then the reason is that you didn't update the defaults on DatasetAggregations
, yet.
|
||
|
||
def test_statistics(arrays) -> None: | ||
with xr.set_options(use_bottleneck=False): |
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.
Haven't tried to make this work with bottleneck / numbagg yet, so turning off bottleneck temporarily for simplicity.
) | ||
else: | ||
# both kwargs were passed, but they are the same value | ||
warnings.warn( |
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.
Should we be using emit_user_level_warning
?
|
||
# TODO check this warns | ||
expected = np_arr.std(ddof=1) | ||
actual = xp_arr.std(skipna=False, ddof=1, correction=1) |
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.
actual = xp_arr.std(skipna=False, ddof=1, correction=1) | |
with pytest.warns(UserWarning, match="ddof and correction both refer to the same thing"): | |
actual = xp_arr.std(skipna=False, ddof=1, correction=1) |
this appears to have been accidentally closed. @TomNicholas, would you be open to finishing this? |
warnings.warn( | ||
"ddof and correction both refer to the same thing - you don't need to pass them both" | ||
) |
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.
warnings.warn( | |
"ddof and correction both refer to the same thing - you don't need to pass them both" | |
) | |
emit_user_level_warning( | |
"ddof and correction both refer to the same thing - you don't need to pass them both" | |
) |
ddof=1
forstd
&var
#8566 (comment)whats-new.rst
api.rst