Fix float conversion to handle blank and non string values - #831
Merged
Conversation
comma_float_to_float swallowed conversion errors and implicitly returned None, so a column typed as Float that held blank entries (e.g. " ") broke dataset upload with "TypeError: NoneType object is not iterable" inside pa.table(). Integer columns hit the same path via the .str accessor. Treat empty and whitespace only entries as nulls, cast non string numeric arrays directly, and raise a ValueError naming the offending values instead of returning None.
cristian-tamblay
approved these changes
Aug 20, 2026
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.
Summary
Uploading a CSV whose Float typed column contains blank entries (a single space,
" ") crashed dataset creation withTypeError: 'NoneType' object is not iterable.comma_float_to_floatcaught every conversion error, printed it, and fell off the end returningNone; thatNonewas then handed topa.table()insidetransform_dataset_with_schema. Integer columns typed as Float hit the same path, since the.straccessor fails on non string series.The conversion now treats empty and whitespace only entries as nulls, casts non string numeric arrays directly, and raises a
ValueErrornaming the offending values instead of silently returningNone.Type of Change
Changes (by file)
DashAI/back/types/utils.py: rewrotecomma_float_to_float. Floating arrays still return unchanged; non string arrays (integer, decimal) cast tofloat64directly; string arrays are stripped,,normalized to., empty and whitespace only values masked to null, then converted withpd.to_numeric. Values that still fail conversion raiseValueErrorlisting up to three samples, so the job surfaces a readable message instead of aNoneTypecrash. Added NumPy style docstring.Testing
Upload a CSV with a Float column containing blanks. Before: job fails with
Error loading dataset: 'NoneType' object is not iterable. After: blanks land as nulls, numeric values preserved asdouble.