Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ENH: add mean keyword to std and var#24126

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Changes from1 commit
Commits
Show all changes
24 commits
Select commitHold shift + click to select a range
5d07178
Add mean keyword to std and var functions.
RonaldAJJul 5, 2023
3ba2ccc
Add releae note for mean keyword to std and var functions.
RonaldAJJul 5, 2023
d52c0b7
Update release note with PR number
RonaldAJJul 5, 2023
3c9e4d3
Address lint issue.
RonaldAJJul 5, 2023
f78e793
Align nan signatures with new signatures.
RonaldAJJul 5, 2023
3bb28dd
Address lint issue.
RonaldAJJul 5, 2023
13161f1
Correct version numbers on keywords.
RonaldAJJul 6, 2023
d93630d
Put backticks on keyword argument in documentation string.
RonaldAJJul 6, 2023
6e966a1
Cleanuup assert statements in tests
RonaldAJJul 6, 2023
fe32fd1
Move comparison of in and out arrays closer to the function call.
RonaldAJJul 6, 2023
a15af41
Remove clutter from example code in release note.
RonaldAJJul 6, 2023
1a10e70
Add test for nanstd and fix error in nanvar
RonaldAJJul 6, 2023
ef7484a
haqndle "mean" keyword for var and std on MaskedArrays.
RonaldAJJul 6, 2023
ccc5258
Address lint issues.
RonaldAJJul 6, 2023
e150370
update the dispatchers according to suggestions by Marten van Kerkwijk:
RonaldAJJul 6, 2023
bbdeed4
Move and adjust example from release note to doc-strings. Reflow doc-…
RonaldAJJul 6, 2023
201034a
Improve doc-string. Shorter sentences and add type and label mean arg…
RonaldAJJul 6, 2023
71998c8
Remove some of these pesky trailing white spaces
RonaldAJJul 6, 2023
0f553ff
Make extra white lines more consistent.
RonaldAJJul 6, 2023
aa861b3
Make sure code examples execute without Jupyter magic.
RonaldAJJul 6, 2023
020257a
Fold lines to pass linter.
RonaldAJJul 6, 2023
f8d8399
Update doc-string nanstd and nanvar.
RonaldAJJul 6, 2023
4f5cc4c
Try to satisfy linter and apple requirements at the same time. Making…
RonaldAJJul 6, 2023
b891190
Make doctest skip resource dependent output
RonaldAJJul 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Move comparison of in and out arrays closer to the function call.
  • Loading branch information
@RonaldAJ
RonaldAJ committedJul 6, 2023
commitfe32fd1a8c1bcebee67bad34e953e86c404e539d
22 changes: 15 additions & 7 deletionsnumpy/core/tests/test_numeric.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -312,12 +312,18 @@ def test_std_with_mean_keyword(self):
axis=1,
keepdims=True)

# The returned object should be the object specified during calling
assert mean_out is mean

std = np.std(A,
out=std_out,
axis=1,
keepdims=True,
mean=mean)

# The returned object should be the object specified during calling
assert std_out is std

# Shape of returned mean and std should be same
assert std.shape == mean.shape
assert std.shape == (10, 1, 5)
Expand All@@ -328,9 +334,7 @@ def test_std_with_mean_keyword(self):
assert std_old.shape == mean.shape
assert_almost_equal(std, std_old)

# The returned objects should be the objects specified during calling
assert mean_out is mean
assert std_out is std


def test_var_with_mean_keyword(self):
# Setting the seed to make the test reproducable
Expand All@@ -345,12 +349,18 @@ def test_var_with_mean_keyword(self):
axis=1,
keepdims=True)

# The returned object should be the object specified during calling
assert mean_out is mean

var = np.var(A,
out=var_out,
axis=1,
keepdims=True,
mean=mean)

# The returned object should be the object specified during calling
assert var_out is var

# Shape of returned mean and var should be same
assert var.shape == mean.shape
assert var.shape== (10, 1, 5)
Expand All@@ -361,9 +371,7 @@ def test_var_with_mean_keyword(self):
assert var_old.shape == mean.shape
assert_almost_equal(var, var_old)

# The returned objects should be the objects specified during calling
assert mean_out is mean
assert var_out is var


def test_std_with_mean_keyword_keepdims_false(self):
rng = np.random.RandomState(1234)
Expand DownExpand Up@@ -511,7 +519,7 @@ def test_std_with_mean_keyword_axis_None(self):

# Shape of returned mean and std should be same
assert std.shape == ()

# Output should be the same as from the individual algorithms
std_old = np.std(A, axis=axis, keepdims=False)

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp