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

dropna #178

Closed
wants to merge 3 commits into from
Closed

dropna #178

wants to merge 3 commits into from

Conversation

pimmeerdink
Copy link
Collaborator

No description provided.

Copy link
Member

@geek-yang geek-yang left a 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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

@BSchilperoort
Copy link
Contributor

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 __init__ method of the class.

@geek-yang
Copy link
Member

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 __init__ method of the class.

Nearly forgot that when we designed this module, we would like to stay as close as possible to the sklearn pipeline recipe. Thanks for mentioning it!

@semvijverberg semvijverberg deleted the dropna branch February 5, 2024 13:49
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.

4 participants