Skip to content
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

Where is move_nanstd? #390

Open
Xiams1921 opened this issue Oct 14, 2021 · 1 comment
Open

Where is move_nanstd? #390

Xiams1921 opened this issue Oct 14, 2021 · 1 comment

Comments

@Xiams1921
Copy link

Xiams1921 commented Oct 14, 2021

the docstring of move_std says: Moving window standard deviation along the specified axis, optionally
ignoring NaNs
.

how can I ignoring NaNs so the function do same thing like nanstd on each moving_window?

I find a function called bn.move_nanstd in old version, but I can't call it in 1.3.2 on linux,

for exmaple:

a = np.array([1, 2, 3, np.nan, 5, 6, 7, 8])
bn.move_std(a, 7) -> array([nan, nan, nan, nan, nan, nan, nan, nan])
bn.nanstd(a) -> 2.4411439272335804

however the result I want is:
bn.move_std(a, 7) -> array([nan, nan, nan, nan, nan, nan, nan, 2.4411439272335804])

@jkadbear
Copy link

bn.move_std(a, window=8, min_count=7) gives the result you want. The default value of min_count is equal to window, which means the moving window result will be nan if any nan value exists in the window.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants