Skip to content

Preserve NaN for unseen levels - #272

Merged
matthewwardrop merged 5 commits into
matthewwardrop:mainfrom
leostimpfle:preserve-nan-in-encode-contrasts
Aug 12, 2026
Merged

matthewwardrop merged 5 commits into
matthewwardrop:mainfrom
leostimpfle:preserve-nan-in-encode-contrasts

Conversation

@leostimpfle

Copy link
Copy Markdown
Contributor

Closes #271. Please let me know any comments!

@leostimpfle

leostimpfle commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor Author

8c99ab9 now also handles the output="sparse" branch.

@matthewwardrop

matthewwardrop commented Aug 12, 2026 •

Copy link
Copy Markdown
Owner

Thanks so much for this patch @leostimpfle . I made a few stylistic tweaks, and some minor performance improvements for the sparse null propagation... but otherwise, this was spot on. Thanks also for adding the unit tests!

This does technically change the dtype of the categorical encoding from ints to floats in the pandas case... but I'm fine with that, I think. I'll check on things a bit before I release the next version :).

@matthewwardrop
matthewwardrop merged commit 81e675b into matthewwardrop:main Aug 12, 2026
6 checks passed
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.

Unseen levels in categorical encodings are cast to 0

2 participants