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

replaced fill_value to 1 instead of close.mean #324

Merged
merged 2 commits into from
Oct 29, 2023

Conversation

yarimiz
Copy link
Contributor

@yarimiz yarimiz commented Sep 5, 2023

As found in #323, DailyReturnIndicator will cause future data leakage when filling nan values (possibly only on the first row, as it's used with shift(1)).

This PR removed the fillna argument from the shift operation. This is because if there is no value for the stock in the previous row, the actual value should be NaN. Later, when calling the daily_return method, the user can chose if to fill the NaN or not.

In any case, filling with close.mean() is wrong.

@bukosabino bukosabino merged commit 70a1e5d into bukosabino:master Oct 29, 2023
@bukosabino
Copy link
Owner

Thank you @yarimiz

The changes will be included in the next version of the library!

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

Successfully merging this pull request may close these issues.

2 participants