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
Remove clutter from example code in release note.
  • Loading branch information
@RonaldAJ
RonaldAJ committedJul 6, 2023
commita15af41ef3ca28b333f3c29934051eeac5888f31
24 changes: 6 additions & 18 deletionsdoc/release/upcoming_changes/24126.change.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,15 @@
Add mean keyword to var and std function
----------------------------------------

Often when the standard deviation is needed the mean is also needed; the same holds for the variance and the mean. With the current code the mean is then calculated twice, the change introduced here for the var and std functions allows for passing in a precalculated mean as an keyword argument.
Often when the standard deviation is needed the mean is also needed; the same holds for the variance and the mean. With the current code the mean is then calculated twice, the change introduced here for the var and std functions allows for passing in a precalculated mean as an keyword argument.

Typical usage would be:

mean = np.mean(A,
out=None,
axis=axis,
keepdims=True)
mean = np.mean(A, axis=axis, keepdims=True)

std = np.std(A,
out=None,
axis=axis,
keepdims=False,
mean=mean)


var = np.var(A,
out=None,
axis=axis,
keepdims=False,
mean=mean)
std = np.std(A, axis=axis, mean=mean)

Note that the mean passed into the std or var function needs to be calculated with keepdims=True.
var = np.var(A, axis=axis, mean=mean)

Note that the mean passed into the std or var function needs to be calculated with ``keepdims=True`` regardless of the corresponding keyword argument passed to std or var itself.


[8]ページ先頭

©2009-2025 Movatter.jp