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

Feature/narwhalify arb imp #390

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

alphanumericmale
Copy link
Contributor

Narwhalification of the arbitrary imputer #315

@liamholmes31
Copy link
Contributor

I think one of the other issues is coming from here:
https://github.com/azukds/tubular/blob/9308197248d24d5452315b742843b2c3f67007bc/tests/imputers/test_BaseImputer.py#L222C1-L222C17

Should be:

expected_df_3["c"] = expected_df_3["c"].cat.add_categories(
                transformer.impute_values_["c"],
            )

@liamholmes31 liamholmes31 marked this pull request as ready for review March 18, 2025 10:17
@liamholmes31
Copy link
Contributor

Note, also:

  • cleaned up some leftover debug prints in package
  • updated narwhals to avoid CI fails from deprecated argument

@cjmwills cjmwills self-assigned this Mar 20, 2025
@cjmwills cjmwills self-requested a review March 20, 2025 16:59
impute_value: float | str,
columns: str | list[str],
**kwargs: dict[str, bool],
impute_value: Union[int, float, str, bool],
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: just checking we're happy to now accept bool values in impute_value? Only because it looks like that wasn't allowed before

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah I think this should be OK, i imagine it was just left out by oversight previously, unless you can think of a reason to exclude?

We have a test that makes sure the falsey value False works, so one potential issue covered there

Copy link
Contributor

Choose a reason for hiding this comment

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

No reason I can think of to be fair, and like you said the test is a good check for it. I've also just noticed the docstring for this will need updating to include bool. Currently it's impute_value : int or float or str

):
transformer.transform(df)

@pytest.mark.parametrize("library", ["pandas", "polars"])
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: strangely there are a couple of the pandas tests here where the transformer doesn't appear to work properly. With the parameters (pandas, 'a', 'String', 'z') the transformer doesn't impute the value z, it just leaves it as null. And then for (pandas, 'c', 'Boolean', True) it actually appears to impute with False. Can you double check you're seeing the same thing?

Copy link
Contributor

Choose a reason for hiding this comment

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

The problem being the tests pass because the dtype has still been preserved

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.

5 participants