Extend ignored columns test to cover np.nan and pd.NA cases - #472
Open
manishaagangadevi wants to merge 1 commit into
Open
Extend ignored columns test to cover np.nan and pd.NA cases#472manishaagangadevi wants to merge 1 commit into
manishaagangadevi wants to merge 1 commit into
Conversation
| enc = getattr(encoders, encoder_name)(cols=['col1']) | ||
| out = enc.fit_transform(X, y) | ||
| self.assertTrue(out.col2[2] is None) | ||
| self.assertTrue(pd.isna(out.col2.iloc[2])) |
Collaborator
There was a problem hiding this comment.
why do you want to relax the check from is None to pd.isna? the precise point of this test is checking that it is still a python None
Author
There was a problem hiding this comment.
Thanks for the clarification.
You’re right, the original test is meant to check that the value stays strictly None. I was trying to extend the test to also cover cases with np.nan and pd.NA, but I realise now that replacing the original assertion changes the intent of the test.
I’ll revert the strict None check and instead add separate tests for np.nan and pd.NA while keeping the original behaviour unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request extends the existing test
test_ignored_columns_are_untouchedto additionally verify that ignored columns remain unchanged when containing
np.nanandpd.NAvalues.The existing test already checks behaviour for
Nonevalues. This change ensuresconsistent handling of other common missing value representations in pandas.
Changes Made
np.nanvalues in ignored columnspd.NAvalues in ignored columns