Repository navigation
ddof vs correction kwargs in std/var - #8573
TomNicholas wants to merge 5 commits into
Conversation
| *, | ||
| skipna: bool | None = None, | ||
| ddof: int = 0, | ||
| ddof: int | None = None, |
There was a problem hiding this comment.
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.
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.
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.
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.
| 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.
| 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=1forstd&var#8566 (comment)whats-new.rstapi.rst