diff --git a/python/tests/fixtures/fixture-multi-dtypes-columns.xlsx b/python/tests/fixtures/fixture-multi-dtypes-columns.xlsx index 4e7211d..384af6d 100644 Binary files a/python/tests/fixtures/fixture-multi-dtypes-columns.xlsx and b/python/tests/fixtures/fixture-multi-dtypes-columns.xlsx differ diff --git a/python/tests/test_dtypes.py b/python/tests/test_dtypes.py index 7dc974f..f5c01b5 100644 --- a/python/tests/test_dtypes.py +++ b/python/tests/test_dtypes.py @@ -42,6 +42,7 @@ def expected_data() -> dict[str, list[Any]]: "Details": ["Healthcare"] * 7 + ["Something"] * 2, "Asset ID": ["84444"] * 7 + ["ABC123"] * 2, "Mixed dates": ["2023-07-21 00:00:00"] * 6 + ["July 23rd"] * 3, + "Mixed bools": ["true"] * 5 + ["false"] * 3 + ["other"], } @@ -92,6 +93,7 @@ def test_sheet_with_mixed_dtypes_and_sample_rows(expected_data: dict[str, list[A ] expected_data["Asset ID"] = [84444.0] * 7 + [None] * 2 expected_data["Mixed dates"] = [datetime(2023, 7, 21)] * 6 + [None] * 3 + expected_data["Mixed bools"] = [True] * 5 + [False] * 3 + [None] pd_df = sheet.to_pandas() pd_assert_frame_equal( diff --git a/src/types/dtype.rs b/src/types/dtype.rs index e264949..9af844a 100644 --- a/src/types/dtype.rs +++ b/src/types/dtype.rs @@ -224,6 +224,7 @@ fn int_types() -> &'static HashSet { fn string_types() -> &'static HashSet { STRING_TYPES_CELL.get_or_init(|| { HashSet::from([ + DType::Bool, DType::Int, DType::Float, DType::String, diff --git a/src/types/python/excelsheet/sheet_data.rs b/src/types/python/excelsheet/sheet_data.rs index 5a4b337..88b68d2 100644 --- a/src/types/python/excelsheet/sheet_data.rs +++ b/src/types/python/excelsheet/sheet_data.rs @@ -134,6 +134,8 @@ mod array_impls { .map(|dt| dt.to_string()) } else if cell.is_datetime_iso() { cell.get_datetime_iso().map(str::to_string) + } else if cell.is_bool() { + cell.get_bool().map(|v| v.to_string()) } else { cell.as_string() }