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
[ENH] Adding min_periods
in WindowSummarizer
to avoid different behaviour in the future
#4052
Conversation
@KishManani @miraep8 Kindly look into and review this PR. |
@arnavrneo do you mind to add a test for this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- linting is failing, see the guide here on how to format your code: https://www.sktime.org/en/stable/developer_guide/coding_standards.html
- not sure whether I understand the deprec message correctly, maybe I am confused - should the
min_periods
not be set to0
rathre thanwindow_length
?
On import pandas as pd
import numpy as np
y = pd.DataFrame(data=np.random.rand(10))
y.rolling(window=3).mean()
0
0
1
2 0.7207749584147084
3 0.5946349404144744
4 0.34069940037566454
5 0.30547069208136307
6 0.5604781957810597
7 0.7837284354272988
8 0.6594005203859353
9 0.44447740298324145
y.rolling(window=3, min_periods=3).mean()
0
0
1
2 0.7207749584147084
3 0.5946349404144744
4 0.34069940037566454
5 0.30547069208136307
6 0.5604781957810597
7 0.7837284354272988
8 0.6594005203859353
9 0.44447740298324145
y.rolling(window=3, min_periods=0).mean()
0
0 0.46538184566621255
1 0.7205428982372711
2 0.7207749584147084
3 0.5946349404144744
4 0.34069940037566454
5 0.30547069208136307
6 0.5604781957810597
7 0.7837284354272988
8 0.6594005203859353
9 0.44447740298324145
|
Thanks, @arnavrneo! Kindly note that linting is failing, see the guide here on how to format your code: https://www.sktime.org/en/stable/developer_guide/coding_standards.html |
@fkiraly On my end, tests have formatted the code. Can you please review it again? |
(I think I fixed the linting issues) |
@fkiraly Okay sir, I will reset the linting check setup. Thank you for going through the linting yourself. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linting issues are fixed now, thanks for your contribution!
…ehaviour in the future (sktime#4052) Fixes sktime#4050 as follows: In the `WindowSummarizer` class, `min_periods` in the `pandas` `rolling` function call is set explicitly, to a value equal to `window_length`.
Reference Issues/PRs
Fixes #4050
What does this implement/fix? Explain your changes.
In the
WindowSummarizer
class,min_periods
is explicitly defined in thepandas
rolling
function call with the value equal to thewindow_length
.Does your contribution introduce a new dependency? If yes, which one?
No.