Repository navigation
Conversation
Preprocessor, PLETransformer and OneHotFromOrdinalTransformer built their output names with np.array(list_of_str), which gives a fixed-width <U array. scikit-learn and the other PreTab transformers return an object array: check_transformer_get_feature_names_out failed on the Preprocessor, and a longer name assigned into a copy was silently truncated. The three methods now return np.asarray(..., dtype=object). Fixes #167
This was referenced Nov 29, 2026
This branch has not been deployed
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.
Fixes #167.
Preprocessor.get_feature_names_out(),PLETransformer.get_feature_names_out()andOneHotFromOrdinalTransformer.get_feature_names_out()returned a fixed-width unicode array (<U15) instead of anobjectarray. scikit-learn'scheck_transformer_get_feature_names_outfailed on thePreprocessor, and a longer name assigned into a copy was silently truncated.Root cause
The three methods returned
np.array(list_of_str), which infers a fixed-width<Udtype. The other PreTab transformers, and scikit-learn, passdtype=object.Fix
The three methods return
np.asarray(names, dtype=object):Preprocessor.get_feature_names_out(pretab/preprocessor.py);PLETransformer.get_feature_names_out(pretab/encoding/numerical/ple.py);OneHotFromOrdinalTransformer.get_feature_names_out(pretab/encoding/categorical/one_hot.py).The names and their order are unchanged.
Behaviour changes
dtype=object. Element values,tolist(), equality checks and use as DataFrame columns are unchanged.<Udtype (for examplenames.dtype.kind == "U") would now see"O", the scikit-learn convention.Documentation
Returnssections of the three methods say the names are anobjectarray.docs/representations/categorical_encoding.mdalready showsdtype=objectand is now accurate. No other docs page shows the dtype.Tests
In
tests/transformers/test_feature_names_in.py:test_feature_names_out_is_an_object_array: every exported transformer, fitted on a DataFrame and on an ndarray. The PLE and OneHotFromOrdinal cases fail onmain; all pass here.test_preprocessor_feature_names_out_is_an_object_array: object dtype, an in-place rename that is not truncated, and scikit-learn'scheck_transformer_get_feature_names_out. Fails onmain, passes here.Reproduction
The script from #167 on this branch:
Checks
just test: 4726 passed, 59 skipped, 7 xfailed; coverage 95.71% (gate 90%).scripts/quickstart.pypasses.just docs: strict build succeeds.just check: all pre-commit and pre-push hooks pass (file hygiene, ruff format, ruff lint, prettier, pyright with 0 errors).Merge notes
main. Git merges this branch cleanly with the other open per-issue branches (fix(binning): reject edges the soft encoding cannot use #150 to fix(preprocessor): reject input without columns at fit #166).