-
Notifications
You must be signed in to change notification settings - Fork 7
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
dropna #178
dropna #178
Conversation
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.
Thanks for the contribution~ 😉 See my comments below. Good job!
@@ -209,13 +209,16 @@ def __init__( # noqa: PLR0913 | |||
self._trend: dict | |||
self._is_fit = False | |||
|
|||
def fit(self, data: Union[xr.DataArray, xr.Dataset]) -> None: | |||
def fit(self, data: Union[xr.DataArray, xr.Dataset], dropna=False) -> None: |
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.
def fit(self, data: Union[xr.DataArray, xr.Dataset], dropna=False) -> None: | |
def fit(self, data: Union[xr.DataArray, xr.Dataset], dropna: bool = False) -> None: |
Also add a type here to please mypy.
@@ -241,16 +243,20 @@ def fit(self, data: Union[xr.DataArray, xr.Dataset]) -> None: | |||
self._is_fit = True | |||
|
|||
def transform( | |||
self, data: Union[xr.DataArray, xr.Dataset] | |||
self, data: Union[xr.DataArray, xr.Dataset], dropna=False |
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.
self, data: Union[xr.DataArray, xr.Dataset], dropna=False | |
self, data: Union[xr.DataArray, xr.Dataset], dropna: bool = False |
"""Fit this Preprocessor to input data. | ||
|
||
Args: | ||
data: Input data for fitting. | ||
dropna: If True, drop all NaN values from the data before preprocessing. |
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.
dropna: If True, drop all NaN values from the data before preprocessing. | |
dropna: If True, drop all NaN values from the data along time axis before preprocessing. |
Point out that this dropna
works only for the time axis.
) -> Union[xr.DataArray, xr.Dataset]: | ||
"""Apply the preprocessing steps to the input data. | ||
|
||
Args: | ||
data: Input data to perform preprocessing. | ||
dropna: If True, drop all NaN values from the data before preprocessing. |
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.
dropna: If True, drop all NaN values from the data before preprocessing. | |
dropna: If True, drop all NaN values from the data along time axis before preprocessing. |
Hi Pim, thanks for your contribution. However, we modeled the .fit and .transform methods on sklearn, where these can be used in a pipeline. I think it would be better to do steps like cleaning up the data separately, instead of modifying the fit/transform methods. An alternative way of adding this functionality, while not adding arguments to the .fit and .tranform methods, would be to add an argument to the |
Nearly forgot that when we designed this module, we would like to stay as close as possible to the |
No description provided.