Skip to content

Commit 8161ebe

Browse files
molearywesm
authored andcommitted
ENH: add more possible bool values to read_csv #1295
1 parent 15717e7 commit 8161ebe

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pandas/src/inference.pyx

+4-2
Original file line numberDiff line numberDiff line change
@@ -681,9 +681,11 @@ def maybe_convert_bool(ndarray[object] arr):
681681
for i from 0 <= i < n:
682682
val = arr[i]
683683

684-
if val == 'True' or type(val) == bool and val:
684+
true_vals = ('True', 'TRUE', 'true', 'Yes', 'YES', 'yes')
685+
false_vals = ('False', 'FALSE', 'false', 'No', 'NO', 'no')
686+
if val in true_vals or type(val) == bool and val:
685687
result[i] = 1
686-
elif val == 'False' or type(val) == bool and not val:
688+
elif val in false_vals or type(val) == bool and not val:
687689
result[i] = 0
688690
else:
689691
return arr

0 commit comments

Comments
 (0)