From dc228e5078b9b53837089936a590ffebd42bf774 Mon Sep 17 00:00:00 2001 From: Karthikeyan Natarajan Date: Wed, 2 Nov 2022 13:35:08 +0530 Subject: [PATCH] pandas vs cudf csv parser differences bool literals give parsing errors as int "0" and "1" give parsing errors as bool in pandas --- python/cudf/cudf/tests/test_csv.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/python/cudf/cudf/tests/test_csv.py b/python/cudf/cudf/tests/test_csv.py index 8a0d15cbfe2..e85d404d2c4 100644 --- a/python/cudf/cudf/tests/test_csv.py +++ b/python/cudf/cudf/tests/test_csv.py @@ -767,10 +767,10 @@ def test_csv_reader_bools(tmpdir, names, dtypes, data, trues, falses): def test_csv_reader_bools_custom(): - names = ["text", "int"] - dtypes = ["str", "int"] - trues = ["foo"] - falses = ["bar"] + names = ["text", "bool"] + dtypes = {"text": "str", "bool": "bool"} + trues = ["foo", "1"] + falses = ["bar", "0"] lines = [ ",".join(names), "true,true", @@ -778,6 +778,7 @@ def test_csv_reader_bools_custom(): "foo,foo", "bar,bar", "0,0", + "1,1", ] buffer = "\n".join(lines) @@ -789,6 +790,9 @@ def test_csv_reader_bools_custom(): true_values=trues, false_values=falses, ) + + # Note: bool literals give parsing errors as int + # "0" and "1" give parsing errors as bool in pandas expected = pd.read_csv( StringIO(buffer), names=names,