fix(plugins): handle unsigned integer columns in pandas/polars converters - #22
Open
belowzeroff wants to merge 1 commit into
Open
fix(plugins): handle unsigned integer columns in pandas/polars converters#22belowzeroff wants to merge 1 commit into
belowzeroff wants to merge 1 commit into
Conversation
…ters Unsigned integer columns (uint8/uint16/uint32/uint64) were absent from the pandas and polars dtype maps, so they fell through to Symbol and crashed the converter with "TypeError: bad argument type for built-in operation". Map them to a signed type wide enough to hold every value without wrapping, mirroring the pyarrow plugin: uint8 -> U8, uint16 -> I32, uint32 -> I64, uint64 -> I64 (no lossless target; values >= 2**63 overflow, same as pyarrow). Also add the numpy "u" dtype kind to the pandas kind fallback.
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.
Problem
Unsigned integer columns (
uint8/uint16/uint32/uint64) were absent from the pandas and polars dtype maps, so they fell through toSymboland crashed the converter on otherwise-valid input:The same happened for polars
UInt8/UInt16/UInt32/UInt64. The pyarrow plugin already handles unsigned columns (#18); pandas and polars were still broken.Fix
Map unsigned columns to a signed type wide enough to hold every value without wrapping, mirroring the pyarrow plugin:
uint64has no lossless target, so values>= 2**63overflow — identical to pyarrow's behaviour. The numpy"u"dtype kind is also added to the pandas kind fallback.Tests
Added
test_from_pandas_unsigned_intsandtest_from_polars_unsigned_ints, each covering all four widths with values above each signed type's midpoint (e.g.uint1665535,uint324294967295) to prove they no longer wrap negative.🤖 Generated with Claude Code