Skip to content

Preserve categorical dtype in LabelEncoder.fit_transform - #1025

Open
AryanRG wants to merge 1 commit into
dask:mainfrom
AryanRG:fix-label-encoder-categorical-dtype
Open

AryanRG wants to merge 1 commit into
dask:mainfrom
AryanRG:fix-label-encoder-categorical-dtype

Conversation

@AryanRG

@AryanRG AryanRG commented Oct 22, 2026 •

Copy link
Copy Markdown

Fixes #602.

LabelEncoder.fit_transform saves dtype_ after categorical values have been replaced with integer codes. Later transform and inverse_transform calls then try to read categorical metadata from that integer dtype.

Save the categorical dtype before encoding. The regression tests cover pandas and Dask inputs, including ordered categories, unused categories and missing values.

The focused tests and Ruff checks pass. The full suite and platform matrix have not been run locally.

@AryanRG AryanRG changed the title [unsupervised AI] Preserve categorical dtype in LabelEncoder.fit_transform Preserve categorical dtype in LabelEncoder.fit_transform Oct 23, 2026
@AryanRG
AryanRG marked this pull request as ready for review October 23, 2026 05:35

This branch has not been deployed

No deployments
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.

Consistent Updating of LabelEncoder Dtype with the "Fit" Interfaces

1 participant