@@ -870,7 +870,7 @@ cdef class TextReader:
870
870
col_dtype = np.dtype(col_dtype).str
871
871
872
872
return self ._convert_with_dtype(col_dtype, i, start, end,
873
- na_filter, na_hashset)
873
+ na_filter, 1 , na_hashset)
874
874
875
875
if i in self .noconvert:
876
876
return self ._string_convert(i, start, end, na_filter, na_hashset)
@@ -879,10 +879,10 @@ cdef class TextReader:
879
879
for dt in dtype_cast_order:
880
880
try :
881
881
col_res, na_count = self ._convert_with_dtype(
882
- dt, i, start, end, na_filter, na_hashset)
882
+ dt, i, start, end, na_filter, 0 , na_hashset)
883
883
except OverflowError :
884
884
col_res, na_count = self ._convert_with_dtype(
885
- ' |O8' , i, start, end, na_filter, na_hashset)
885
+ ' |O8' , i, start, end, na_filter, 0 , na_hashset)
886
886
887
887
if col_res is not None :
888
888
break
@@ -891,14 +891,16 @@ cdef class TextReader:
891
891
892
892
cdef _convert_with_dtype(self , object dtype, Py_ssize_t i,
893
893
int start, int end,
894
- bint na_filter, kh_str_t * na_hashset):
894
+ bint na_filter,
895
+ bint user_dtype,
896
+ kh_str_t * na_hashset):
895
897
cdef kh_str_t * true_set, * false_set
896
898
897
899
if dtype[1 ] == ' i' or dtype[1 ] == ' u' :
898
900
result, na_count = _try_int64(self .parser, i, start, end,
899
901
na_filter, na_hashset)
900
- # if na_count > 0:
901
- # raise Exception('Integer column has NA values')
902
+ if user_dtype and na_count > 0 :
903
+ raise Exception (' Integer column has NA values' )
902
904
903
905
if dtype[1 :] != ' i8' :
904
906
result = result.astype(dtype)
0 commit comments