Skip to content

Commit

Permalink
fix: do not cast None to str in ArrowBackend
Browse files Browse the repository at this point in the history
  • Loading branch information
tconbeer committed Oct 31, 2024
1 parent a7d1717 commit 08ee735
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
## [Unreleased]

- Adds an optional parameter to DataTable to disable rendering of string data as Rich Markup.
- Fixes a bug where None could be casted to a string and displayed as "None" ([tconbeer/harlequin#658](https://github.com/tconbeer/harlequin/issues/658))

## [0.9.0] - 2024-07-23

Expand Down
5 changes: 4 additions & 1 deletion src/textual_fastdatatable/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,10 @@ def from_pydict(
except (pal.ArrowInvalid, pal.ArrowTypeError):
# one or more fields has mixed types, like int and
# string. Cast all to string for safety
new_data = {k: [str(val) for val in v] for k, v in data.items()}
new_data = {
k: [str(val) if val is not None else None for val in v]
for k, v in data.items()
}
tbl = pa.Table.from_pydict(new_data)
return cls(tbl, max_rows=max_rows)

Expand Down

0 comments on commit 08ee735

Please sign in to comment.