Skip to content

Fix float conversion to handle blank and non string values - #831

Merged
cristian-tamblay merged 1 commit into
developfrom
fix/comma-float-blank-values
Aug 20, 2026
Merged

Fix float conversion to handle blank and non string values#831
cristian-tamblay merged 1 commit into
developfrom
fix/comma-float-blank-values

Conversation

@Irozuku

@Irozuku Irozuku commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

Uploading a CSV whose Float typed column contains blank entries (a single space, " ") crashed dataset creation with TypeError: 'NoneType' object is not iterable. comma_float_to_float caught every conversion error, printed it, and fell off the end returning None; that None was then handed to pa.table() inside transform_dataset_with_schema. Integer columns typed as Float hit the same path, since the .str accessor 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 ValueError naming the offending values instead of silently returning None.


Type of Change

  • Backend change
  • Frontend change
  • CI / Workflow change
  • Build / Packaging change
  • Bug fix
  • Documentation

Changes (by file)

  • DashAI/back/types/utils.py: rewrote comma_float_to_float. Floating arrays still return unchanged; non string arrays (integer, decimal) cast to float64 directly; string arrays are stripped, , normalized to ., empty and whitespace only values masked to null, then converted with pd.to_numeric. Values that still fail conversion raise ValueError listing up to three samples, so the job surfaces a readable message instead of a NoneType crash. 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 as double.

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.
@Irozuku Irozuku added bug Something isn't working back Backend work labels Aug 19, 2026
@cristian-tamblay
cristian-tamblay merged commit 385ec75 into develop Aug 20, 2026
20 checks passed
@cristian-tamblay
cristian-tamblay deleted the fix/comma-float-blank-values branch August 20, 2026 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

back Backend work bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants