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
Try to satisfy linter and apple requirements at the same time. Making…
… the example code ugly, alas!
  • Loading branch information
@RonaldAJ
RonaldAJ committedJul 6, 2023
commit4f5cc4c8e81c09c790e3a173603ed5bed54430ca
14 changes: 8 additions & 6 deletionsnumpy/core/fromnumeric.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3641,9 +3641,10 @@ def std(a, axis=None, dtype=None, out=None, ddof=0, keepdims=np._NoValue, *,
>>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]])
>>> mean = np.mean(a, axis=1, keepdims=True)
>>>
>>> t1 = timeit("std = np.std(a, axis=1, mean=mean)",
>>> globals=globals(), number=10000)
>>> t2 = timeit("std = np.std(a, axis=1)", globals=globals(), number=10000)
>>> g = globals()
>>> n = 10000
>>> t1 = timeit("std = np.std(a, axis=1, mean=mean)", globals=g, number=n)
>>> t2 = timeit("std = np.std(a, axis=1)", globals=g, number=n)
>>> print(f'Percentage execution time saved {100*(t2-t1)/t2:.0f}%')
Percentage execution time saved 30%

Expand DownExpand Up@@ -3804,9 +3805,10 @@ def var(a, axis=None, dtype=None, out=None, ddof=0, keepdims=np._NoValue, *,
>>> a = np.array([[14, 8, 11, 10], [7, 9, 10, 11], [10, 15, 5, 10]])
>>> mean = np.mean(a, axis=1, keepdims=True)
>>>
>>> t1 = timeit("var = np.var(a, axis=1, mean=mean)",
>>> globals=globals(), number=10000)
>>> t2 = timeit("var = np.var(a, axis=1)", globals=globals(), number=10000)
>>> g = globals()
>>> n = 10000
>>> t1 = timeit("var = np.var(a, axis=1, mean=mean)", globals=g, number=n)
>>> t2 = timeit("var = np.var(a, axis=1)", globals=g, number=n)
>>> print(f'Percentage execution time saved {100*(t2-t1)/t2:.0f}%')
Percentage execution time saved 32%

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp